同一頁面上的圖像和新部分

同一頁面上的圖像和新部分

我希望圖像位於頁面頂部,新部分在同一頁面的圖像下方開始。我嘗試使用 [t] 定位影像,但沒有任何變化。圖像出現在頁面中央,新部分在新頁面上開始...我該如何解決這個問題?

這是我的程式碼:

 \documentclass[12pt,a4paper]{article}

\usepackage[MeX]{polski}
\usepackage{lmodern}
\usepackage{inputenc}
\usepackage{fontenc}
\usepackage{cite}
\usepackage{amsmath,amssymb,amsfonts,amsthm}
\usepackage{graphicx}
\usepackage{epstopdf}
\usepackage[tight,footnotesize]{subfigure}
\usepackage{listings}
\usepackage{courier}
\usepackage{fixltx2e}
\usepackage{xcolor}
\usepackage[section]{placeins}
\usepackage[small]{caption}
\usepackage[polish]{babel}
\usepackage{advdate}
\usepackage[colorlinks=true,citecolor=blue,linkcolor=blue,urlcolor=blue]{hyperref}
\usepackage[top=2cm,left=2cm,bottom=2cm,right=2cm]{geometry}

\begin{document}

\title{zzz}

\author{zzz}

\date{\today}

\maketitle

\section{A}\label{sec:a}

\begin{figure}[h]
\makebox[\textwidth][c]{\includegraphics[width=1\textwidth]{a.jpg}}
\caption{xxxx}
\label{label}
\end{figure}

\begin{figure}[h]
\makebox[\textwidth][c]{\includegraphics[width=1\textwidth]{a.jpg}}
\caption{xxxx}
\label{label}
\end{figure}

\begin{figure}[ht]
\makebox[\textwidth][c]{\includegraphics[width=1\textwidth]{a.jpg}}
\caption{xxxx}
\label{label}
\end{figure}

\begin{figure}[ht]
\makebox[\textwidth][c]{\includegraphics[width=1\textwidth]{a.jpg}}
\caption{xxxx}
\label{label}
\end{figure}

\section{B}\label{sec:b}


\end{document}

在此輸入影像描述

答案1

後:

  • 將您的範例減少到最少(我保留是lmodern因為它沒有與電腦現代相同的指標);

  • 將全部替換\begin{figure}[h]\begin{figure}[ht](LaTeX 輸出告訴您它已經以這種方式工作了);

  • 刪除無用的\makebox[\textwidth][c]{...}呼叫(您\includegraphics[width=1\textwidth]{...}已經建立了一個很寬的框\textwidth);

  • 使用所有 TeX 安裝中存在的映像(如果您想在此處包含具有精確尺寸的映像以便我們重現您的問題,請使用類似\includegraphics[width=\textwidth, height=1cm]{example-image}或類似的example-image-aexample-image-b等);

  • 刪除所有無用的(此處)和重複的標籤(閱讀 LaTeX 輸出!),

一個到達:

\documentclass[12pt,a4paper]{article}
\usepackage{lmodern}
\usepackage{graphicx}
\usepackage[top=2cm,left=2cm,bottom=2cm,right=2cm]{geometry}

\title{zzz}

\author{zzz}

\date{\today}

\begin{document}

\maketitle

\section{A}

\begin{figure}[ht]
\includegraphics[width=\textwidth]{example-image}
\caption{xxxx}
\end{figure}

\begin{figure}[ht]
\includegraphics[width=\textwidth]{example-image}
\caption{xxxx}
\end{figure}

\begin{figure}[ht]
\includegraphics[width=\textwidth]{example-image}
\caption{xxxx}
\end{figure}

\begin{figure}[ht]
\includegraphics[width=\textwidth]{example-image}
\caption{xxxx}
\end{figure}

\section{B}

\end{document}

在此輸入影像描述

這並不像是錯誤的圖形放置......

相關內容