Latex 中的線條和文字不會出現在同一頁上

Latex 中的線條和文字不會出現在同一頁上

我本來想深入研究一下 LaTeX,並想用它來寫一份履歷,但在開始寫履歷之前,我想先學習 Latex 的精髓。在嘗試創建一條線時,我遇到了一些問題。

當我在文字下方或上方畫一條線時,同時產生pdf(使用pdflatex),這些線不會出現在同一頁中,而是線出現在新頁面中,而文字出現在不同的頁面中。

這是程式碼

%Trying out rules in Latex

\documentclass{article}
\begin{document}

\title{Rules in \LaTeX{}}
\line(1,0){250}
\author{Shashwat Pant}
\maketitle


\end{document}

如果我使用\hrulefill\line我只在文檔中獲取行,但如果我使用 Texmaker 則沒有文本,但是如果我使用編譯它,pdflatex我會在首頁中獲取行並在其他頁面中獲取文本。那麼,我如何實際繪製一條水平線,接觸紙張的每一端,但仍保留在某些文字下方,例如分隔符號。

答案1

排版標題是\maketitle命令的工作,它依賴內部命令\@maketitle,所以你必須修改這一點:

\documentclass{article}

\makeatletter
\def\@maketitle{%
  \newpage
  \null
  \vskip 2em
  \begin{center}
  \let \footnote \thanks
    {\LARGE \@title \par}
    \vskip 1.5em
  %%% Addition
    \hrule
    \vskip 1.5em
  %%% End addition
    {\large
      \lineskip .5em
      \begin{tabular}[t]{c}
        \@author
      \end{tabular}\par}
    \vskip 1em
    {\large \@date}
  \end{center}
  \par
  \vskip 1.5em}
\makeatother

\begin{document}

\title{Rules in \LaTeX{}}
\author{Shashwat Pant}
\maketitle


\end{document}

在此輸入影像描述

相關內容