为什么 LaTeX 没有使用 geometry 包进行居中

为什么 LaTeX 没有使用 geometry 包进行居中

我正在摆弄 LaTeX,并试图将标题置于法律尺寸纸张的顶部,边距为 0.25 英寸。我无法使用 center 环境\centering或将标题置于中心\centerline。如果我删除geometry包,输出将符合预期。我做错了什么?

\documentclass[10pt,legalpaper]{report}

\usepackage[margin=.25in,text={8in,13.5in},centering]{geometry}

\begin{document}

\begin{center}
ARIZONA PRELIMINARY TWENTY DAY NOTICE \newline 
IN ACCORDANCE WITH ARIZONA REVISED STATUTES SECTION 33-992.01  \newline
THIS IS NOT A LIEN AND IS NOT A REFLECTION ON THE INTEGRITY OF ANY CONTRACTOR OR          SUBCONTRACTOR 
\end{center}
\end{document}

答案1

您使用的\newline弄乱了段落对齐。以下是使用段落分隔符(\par,通过\\)或将其设置为居中对齐的另一种方法tabularx

在此处输入图片描述

\documentclass[10pt]{report}
\usepackage[margin=.25in,paper=legalpaper]{geometry}% http://ctan.org/pkg/geometry
\usepackage{tabularx}% http://ctan.org/pkg/tabularx
\begin{document}

\begin{center}
  ARIZONA PRELIMINARY TWENTY DAY NOTICE \newline 
  IN ACCORDANCE WITH ARIZONA REVISED STATUTES SECTION 33-992.01  \newline
  THIS IS NOT A LIEN AND IS NOT A REFLECTION ON THE INTEGRITY 
    OF ANY CONTRACTOR OR SUBCONTRACTOR 
\end{center}

\begin{center}
  ARIZONA PRELIMINARY TWENTY DAY NOTICE \\
  IN ACCORDANCE WITH ARIZONA REVISED STATUTES SECTION 33-992.01 \\
  THIS IS NOT A LIEN AND IS NOT A REFLECTION ON THE INTEGRITY 
    OF ANY CONTRACTOR OR SUBCONTRACTOR 
\end{center}

\noindent
{\renewcommand{\tabularxcolumn}[1]{>{\centering\arraybackslash}p{#1}}%
\begin{tabularx}{\linewidth}{X}
  ARIZONA PRELIMINARY TWENTY DAY NOTICE \\
  IN ACCORDANCE WITH ARIZONA REVISED STATUTES SECTION 33-992.01 \\
  THIS IS NOT A LIEN AND IS NOT A REFLECTION ON THE INTEGRITY 
    OF ANY CONTRACTOR OR SUBCONTRACTOR 
\end{tabularx}}
\end{document}

答案2

在环境中使用\\而不是。被重新定义,它结束段落,但删除。保留原意。 它在通常的两端对齐段落中结束一行。 强制换行需要填充当前行并添加。 这会弄乱以 结尾的前两行的居中:在环境中左侧和右侧,并且附加的通过强制将三分之一的可用空间放在左侧,将三分之二放在右侧。\newlinecenter\\\parskip\newline\newline\hfil\newline1fil1filcenter1fil\hfil\newline

例如\\

\documentclass[10pt,legalpaper]{report}

\usepackage[margin=.25in,text={8in,13.5in},centering]{geometry}

\begin{document}

\begin{center}
ARIZONA PRELIMINARY TWENTY DAY NOTICE \\
IN ACCORDANCE WITH ARIZONA REVISED STATUTES SECTION 33-992.01  \\
THIS IS NOT A LIEN AND IS NOT A REFLECTION ON THE INTEGRITY OF ANY
CONTRACTOR OR SUBCONTRACTOR
\end{center}
\end{document}

结果

相关内容