我有以下对齐不良的标题。
\documentclass[a4paper,12pt]{article}
\usepackage[landscape,margin=10mm]{geometry}
\pagestyle{empty}
\begin{document}
\begin{minipage}[r]{0.19\textwidth}
\rule{30mm}{30mm}
\end{minipage}%
\hfill
\begin{minipage}[c]{0.58\textwidth}
\begin{center}
{\Huge Title}
\end{center}
\end{minipage}%
\hfill
\begin{minipage}[r]{0.19\textwidth}
\rule{30mm}{30mm}
\end{minipage}%
\end{document}
答案1
请注意,您的示例未给出期望结果的原因是因为0.19\textwidth
它远大于 30 毫米\rule{30mm}{30mm}
。
以下是我:
\documentclass[a4paper,12pt]{article}
\usepackage[showframe,landscape,margin=10mm]{geometry}
\usepackage{calc}
\pagestyle{empty}
\newcommand{\logo}{\rule{30mm}{30mm}} % More than likely an \includegraphics here
\newlength\logowidth
\setlength{\logowidth}{\widthof{\logo}} % Place the logo declaration here
\begin{document}
\noindent
\begin{minipage}[c]{\logowidth}
\logo
\end{minipage}\hfill
\begin{minipage}[c]{0.58\textwidth}
\begin{center}
{\Huge Title}
\end{center}
\end{minipage}\hfill
\begin{minipage}[c]{\logowidth}
\logo
\end{minipage}
\end{document}
以下是带图形的版本:
\documentclass[a4paper,12pt]{article}
\usepackage[showframe,landscape,margin=10mm]{geometry}
\usepackage{calc}
\usepackage{mwe} % For graphics purpose only.
\pagestyle{empty}
\newcommand{\logo}{\includegraphics[width=30mm]{example-image-a}}
\newlength\logowidth
\setlength{\logowidth}{\widthof{\logo}}
\begin{document}
\noindent
\begin{minipage}[c]{\logowidth}
\logo
\end{minipage}\hfill
\begin{minipage}[c]{0.58\textwidth}
\begin{center}
{\Huge Title}
\end{center}
\end{minipage}\hfill
\begin{minipage}[c]{\logowidth}
\logo
\end{minipage}
\end{document}
答案2
我可以提出一个简单的解决方案tabularx
:
\documentclass[a4paper,12pt]{article}
\usepackage[landscape,margin=10mm, showframe]{geometry}
\usepackage{tabularx}
\pagestyle{empty}
\begin{document}
{\renewcommand\tabularxcolumn[1]{>{\centering\huge\arraybackslash}m{#1}}
\noindent\begin{tabularx}{\linewidth}{@{\hspace{\parindent}}m{30mm}Xm{30mm}@{\hspace{\parindent}}}
\rule{30mm}{30mm} & Title & \rule{30mm}{30mm}
\end{tabularx}}
\end{document}
答案3
第三种可能性是不使用任何包(除了graphicx
和geometry
):
\documentclass[a4paper,12pt]{article}
\usepackage[landscape,margin=10mm]{geometry}
\usepackage{graphicx}
\pagestyle{empty}
\begin{document}
\hbox to \textwidth{%
\includegraphics[width=30mm, height=30mm]{example-image-a}%
\hfill%
\parbox[b][30mm][c]{0.58\textwidth}{\centering\Huge Title}% change the width of the parbox to your liking
\hfill%
\includegraphics[width=30mm, height=30mm]{example-image-b}%
}
\end{document}