如何在这里换行

如何在这里换行

我想将上面的单行信息分成三行:

我的输出

我的代码如下:

\documentclass{article}
\usepackage[T1]{fontenc}
\usepackage[utf8]{inputenc}
\usepackage[english]{babel}
\usepackage{geometry}
 \geometry{
 a4paper,
 total={180mm,266mm},
 left=15mm,
 top=14mm,
 }

\setlength{\parindent}{0em}
\setlength{\parskip}{1.4em}  


\newcommand{\HRule}{\rule{\linewidth}{0.5mm}}

\makeatletter% since there's an at-sign (@) in the command name
\renewcommand{\@maketitle}{%
  %\parindent=0pt% don't indent paragraphs in the title block
  {\begin{minipage}[t]
    {.5\textwidth}
    \@author
  \end{minipage}
  \begin{minipage}[t]
    {.5\textwidth}
    \raggedleft\@date
  \end{minipage}
  }
  \par
  \centering
  {\Large \bfseries\textsc{\@title}}
  \HRule\par%
}
\makeatother% resets the meaning of the at-sign (@)

\title{Motivation Letter}

\author{%
Application for Master of Science\\
Computer Science\\
The University of X}

\date{%
Sourav Chakraborty\\
[email protected]}



\begin{document}
\maketitle

\vspace{4em}

\def\sign#1{\rlap{\lower-1ex\hbox{#1}}\hfil}
\hbox to\hsize{
    \sign{\date{\today}}
    \quad \sign{RKM Boys Home, Rahara, \newline
                Kolkata - 700112, West Bengal, \newline
                India \newline}
    \quad \sign{}
}

\def\sign#1{\rlap{\lower2.6ex\hbox{ #1}}\leaders\hrule height 0.46mm \hfil}
\hbox to\hsize{\sign{Date}\quad \sign{Place}\quad \sign{Signature}}

\end{document}

答案1

将它们添加到\vbox命令中可能会对您有用:

\documentclass{article}
\usepackage[T1]{fontenc}
\usepackage[utf8]{inputenc}
\usepackage[english]{babel}
\usepackage{geometry}
 \geometry{
 a4paper,
 total={180mm,266mm},
 left=15mm,
 top=14mm,
 }

\setlength{\parindent}{0em}
\setlength{\parskip}{1.4em}  


\newcommand{\HRule}{\rule{\linewidth}{0.5mm}}

\makeatletter% since there's an at-sign (@) in the command name
\renewcommand{\@maketitle}{%
  %\parindent=0pt% don't indent paragraphs in the title block
  {\begin{minipage}[t]
    {.5\textwidth}
    \@author
  \end{minipage}
  \begin{minipage}[t]
    {.5\textwidth}
    \raggedleft\@date
  \end{minipage}
  }
  \par
  \centering
  {\Large \bfseries\textsc{\@title}}
  \HRule\par%
}
\makeatother% resets the meaning of the at-sign (@)

\title{Motivation Letter}

\author{%
Application for Master of Science\\
Computer Science\\
The University of X}

\date{%
Sourav Chakraborty\\
[email protected]}



\begin{document}
\maketitle

\vspace{4em}

\def\sign#1{\rlap{\lower-1ex\hbox{#1}}\hfil}
\hbox to\hsize{
    \sign{\date{\today}}
    \quad \sign{\vbox{RKM Boys Home, Rahara, \newline
                Kolkata - 700112, West Bengal, \newline
                India}}
    \quad \sign{}
}

\def\sign#1{\rlap{\lower2.6ex\hbox{ #1}}\leaders\hrule height 0.46mm \hfil}
\hbox to\hsize{\sign{Date}\quad \sign{Place}\quad \sign{Signature}}

\end{document}

在此处输入图片描述

编辑:更好的选择似乎是这样的:(代码已更改)

\documentclass{article}
\usepackage[T1]{fontenc}
\usepackage[utf8]{inputenc}
\usepackage[english]{babel}
\usepackage{geometry}
 \geometry{
 a4paper,
 total={180mm,266mm},
 left=15mm,
 top=14mm,
 }

\setlength{\parindent}{0em}
\setlength{\parskip}{1.4em}  


\newcommand{\HRule}{\rule{\linewidth}{0.5mm}}


\makeatletter% since there's an at-sign (@) in the command name
\newcommand{\email}[1]{\def\@email{#1}}
\renewcommand{\@maketitle}{%
  %\parindent=0pt% don't indent paragraphs in the title block
  {\begin{minipage}[t]
    {.5\textwidth}
    \@author
  \end{minipage}
  \begin{minipage}[t]
    {.5\textwidth}
    \raggedleft\@email
  \end{minipage}
  }
  \par
  \centering
  {\Large \bfseries\textsc{\@title}}
  \HRule\par%
}
\makeatother% resets the meaning of the at-sign (@)

\newcommand\sign[2]{\begin{minipage}[b]{0.3\textwidth}#1\par\vspace{1em}\hrule height 0.46mm \hfil\par#2\par\vspace{1em}\end{minipage}}


\title{Motivation Letter}

\author{%
Application for Master of Science\\
Computer Science\\
The University of X}

\email{%
Sourav Chakraborty\\
[email protected]}



\begin{document}
\maketitle

\vspace{4em}


\sign{\today}{Date}\hfil\sign{RKM Boys Home, Rahara,\\
                Kolkata - 700112, West Bengal,\\
                India}{Place}\hfil\sign{}{Signature}




\end{document}

答案2

另一个选择(我认为比 koleygr 的更糟糕)是minipage再次雇用。

\documentclass{article}
\usepackage[T1]{fontenc}
\usepackage[utf8]{inputenc}
\usepackage[english]{babel}
\usepackage{geometry}
 \geometry{
 a4paper,
 total={180mm,266mm},
 left=15mm,
 top=14mm,
 }

\setlength{\parindent}{0em}
\setlength{\parskip}{1.4em}  


\newcommand{\HRule}{\rule{\linewidth}{0.5mm}}

\makeatletter% since there's an at-sign (@) in the command name
\renewcommand{\@maketitle}{%
  %\parindent=0pt% don't indent paragraphs in the title block
  {\begin{minipage}[t]{.5\textwidth}
    \@author
  \end{minipage}%
  \begin{minipage}[t]{.5\textwidth}
    \raggedleft\@date
  \end{minipage}
  }
  \par
  \centering
  {\Large \bfseries\textsc{\@title}}
  \HRule\par%
}
\makeatother% resets the meaning of the at-sign (@)

\title{Motivation Letter}

\author{%
Application for Master of Science\\
Computer Science\\
The University of X}

\date{%
Sourav Chakraborty\\
[email protected]}



\begin{document}
\maketitle

\vspace{4em}

\def\sign#1{\rlap{\lower-1ex\hbox{#1}}\hfil}
\hbox to\hsize{
    \sign{\date{\today}}
    \quad \sign{\begin{minipage}[b]{5cm}RKM Boys Home, Rahara, \\
                Kolkata - 700112, West Bengal,\\
                India\end{minipage}}
    \quad \sign{}
}

\def\sign#1{\rlap{\lower2.6ex\hbox{ #1}}\leaders\hrule height 0.46mm \hfil}
\hbox to\hsize{\sign{Date}\quad \sign{Place}\quad \sign{Signature}}

\end{document}

在此处输入图片描述

相关内容