如何在頁面中間而不是頂部顯示圖形

如何在頁面中間而不是頂部顯示圖形

我在附錄頁面中顯示了一個圖表列表,每個圖表都在單獨的頁面上。這些數字顯示在頁面的頂部。我想知道是否可以將數字放在頁面中間,這樣頁面的下半部就不會看起來是空的。請問這個可以背頁嗎?非常感謝

答案1

為此,您可以p僅使用選項(即\begin{figure}[p] ... \end{figure})強制浮動在浮動頁面中,其中數字自動居中,但請記住頁面浮動的目的是收集文字中分散的浮動。如果發生這種情況(並且這是不希望的),您可以透過\clearpage後浮動來防止這種情況。例子:

\documentclass{article}
\usepackage{float,url}
\usepackage{graphicx}
\def\exampleimage#1{\begin{figure}[p] 
\centering \includegraphics[width=#1\textwidth]{example-image} 
\caption{Example} 
\end{figure}}

\begin{document}

Helo word 

\exampleimage{} \newpage % \newpage works here only if the image is enough big!  

\exampleimage{.3}\exampleimage{.3}\clearpage % two small figures centred

\exampleimage{.5}\clearpage % single centred image

\end{document}

如果您想要在浮動之前和/或之後添加一些文本,只需使用該選項並在文本和浮動之間[h]添加,即:\vfill

Some text 
\vfill
\begin{figure}[h] 
  \centering \includegraphics[width=\textwidth]{example-image} 
  \caption{Example} 
\end{figure}
\vfill
Some text 

請注意,這將使圖形相對於可用空白空間居中。如果您想要讓圖像相對於頁面居中,無論上方/下方文字的數量有多少,一種解決方案可以將兩個文字區塊放在高度相等的小頁面中。

相關內容