Graphicx includegraphics 以全域為中心

Graphicx includegraphics 以全域為中心

是否可以全域設定\includegraphics圖片在頁面上水平居中?

我閱讀了手冊並看到一些不熟悉的全域設定鍵:\setkeys{Gin}{width=0.75\textwidth}

答案1

我假設您的頁邊距在頁面上是對稱的。如果沒有,請這麼說。

\documentclass{article}
\usepackage[showframe,pass]{geometry}
\usepackage{graphicx}
\begin{document}
\centerline{\includegraphics[width=.3\textwidth]{example-image}}

\centerline{\includegraphics[width=1.1\textwidth]{example-image}}
\end{document}

在此輸入影像描述

答案2

\includegraphics\parbox與大多數類似的 LaTeX 結構(例如 等)一樣tabular,它不是顯示結構,它只是一個內聯框,因此定位像一個大字母,它沒有控制其位置的機制。您可以將圖形居中,就像將單字居中一樣,將其放置在\centering或的範圍內\begin{center}...\end{center}

相關內容