小页面中的文本对齐

小页面中的文本对齐

我正在用 LaTeX 写我的试卷。我只有一个小疑问。我使用的代码是:

\documentclass[12pt,paper=a4,answers, addpoints]{exam}
\usepackage{graphicx,lastpage}
\usepackage{upgreek}
\usepackage{censor}
\usepackage{amsmath}
\usepackage{eurosym}
\censorruledepth=-.2ex
\censorruleheight=.1ex
\hyphenpenalty 10000
\usepackage[paperheight=10.5in,paperwidth=8.27in,bindingoffset=0in,left=0.8in,right=1in,
top=1in,bottom=1in,headsep=1.5\baselineskip]{geometry}
\flushbottom
\usepackage[normalem]{ulem}
\usepackage[utf8]{inputenc}
\renewcommand\ULthickness{2pt} %%---> For changing thickness of underline
\setlength\ULdepth{1.5ex}%\maxdimen ---> For changing depth of underline
\renewcommand{\baselinestretch}{1}
\pagestyle{empty}

\pagestyle{headandfoot}
\headrule
\newcommand{\continuedmessage}{%
\ifcontinuation{\footnotesize Question \ContinuedQuestion\ continues\ldots}{}%
}
\runningheader{\footnotesize Dipartimento di Economia}
{\footnotesize Economia Pubblica -- L33}
{\footnotesize Pagina \thepage\ di \numpages}
\footrule
\footer{\footnotesize}
{}
{\ifincomplete{\footnotesize Question \IncompleteQuestion\ Continua nella pagina successiva}{\iflastpage{\footnotesize \textit{\bfseries Fine domande di esame}}{\footnotesize \textit{\bfseries Continua nella pagina successiva}}}}

\usepackage{cleveref}
\crefname{figure}{figure}{figures}
\crefname{question}{question}{questions}
\renewcommand\thequestion{\arabic{question}}
\renewcommand{\questionlabel}{\thequestion)}
\renewcommand{\questionshook}{%
\setlength{\leftmargin}{0pt}%
\setlength{\labelwidth}{-\labelsep}%
}

\nopointsinmargin 
\pointpoints{Punto}{Punti}

\marginpointname{\points}
\pointformat{\boldmath\themarginpoints}
\bracketedpoints

\begin{document}

\thispagestyle{empty}

\noindent
\begin{minipage}[t]{\textwidth}%
\centering
\includegraphics[width=1.5cm]{logo} \par
\textit{\textbf{University of XXX}}\par
\textit{\textbf{Dipartiment  of XXX}} \par
\smallskip
\textit{\textbf{Seconda Sessione \\ Terzo Appello}} 
\end{minipage}
\par
\bigskip\bigskip
\begin{minipage}[t]{.5\textwidth}%
{\bfseries Corso di Studio}: First course \\ Second course\\ Third Course \par
\vspace{1ex}
{\bfseries Codice del corso di laurea}: XXX\par
\vspace{1ex}
{\bfseries Materia}: XXXX \par
\vspace{1ex}
{\bfseries Data}: XXX \par
\vspace{1ex}
{\bfseries Docente}: XXX
\end{minipage}%
\hfill
\begin{minipage}[t]{.4\textwidth}%
{\bfseries Nome}: {\hrulefill} \par
\vspace{1ex} 
{\bfseries Matricola}: {\hrulefill} \par
\vspace{1ex}
{\bfseries Documento}: {\hrulefill} \par
\vspace{1ex}
{\bfseries Durata}: 1.5 h + 10 minuti di lettura\par
\vspace{1ex}
{\bfseries Firma}:{\hrulefill} 
\end{minipage}
\par
\bigskip
\begin{center}
\rule{\textwidth}{1pt}
\end{center}
\bigskip
\end{document}

结果是:

在此处输入图片描述

基本上,我想将“第二道菜”和“第三道菜”排列在“第一道菜”下面。

你有什么建议吗?

谢谢。

答案1

tabular对于课程

这三门课程可以放在tabular

\textbf{Corso di Studio:}
\begin{tabular}[t]{@{}l@{}}
  First course\\
  Second course\\
  Third course\\
\end{tabular}

结果

tabularx有两列

X列类型是p使用可用空间的列类型。

\documentclass{article}
\usepackage{tabularx}

\begin{document}
\noindent
\begin{minipage}{.5\textwidth}
\begin{tabularx}{\linewidth}{@{}l@{ }X@{}}
  \bfseries Corso di Studio:&
  First course\newline
  Second course\newline
  Third course
\end{tabularx}
\end{minipage}
\end{document}

课程设置varwidth

环境与或varwidth类似,但指定的宽度仅为最大宽度。如果内容较小,则结果使用较小的宽度。minipage\parbox

\documentclass{article}
\usepackage{varwidth}

\begin{document}
\noindent
\textbf{Corso di Studio:}
\begin{varwidth}[t]{\linewidth}% truncated to the needed space
  First course\\
  Second course\\
  Third course
\end{varwidth}
\end{document}

答案2

我建议你更换

\par
\bigskip\bigskip
\begin{minipage}[t]{.5\textwidth}%
{\bfseries Corso di Studio}: First course \\ Second course\\ Third Course \par
\vspace{1ex}

\par
\bigskip\bigskip
\noindent  % <--- new
\begin{minipage}[t]{.5\textwidth}%
{\bfseries Corso di Studio}: 
\parbox[t]{4cm}{First course \\ 
                Second course\\ 
                Third Course }
\par\bigskip

观察宏的使用。此外,请注意前面的\parbox新指令。\noindent\begin{minipage}

在此处输入图片描述

答案3

只是为了好玩,没有tabular,没有minipage,没有无处不在\vspace{1ex}

姆韦

\documentclass[12pt,paper=a4,answers, addpoints]{exam}
\usepackage{tabto,graphicx}
\TabPositions{0pt, 0.23\linewidth,  0.5\linewidth}
\begin{document}
{\obeylines{\centering
\includegraphics[width=5em]{mesina.png}
\em\bfseries
University of XXX
Dipartiment of XXX \smallskip
Seconda Sessione
Terzo Appello
}
\bigskip\bigskip
\parskip1ex\parindent0pt
{\bfseries Corso di Studio}: \tab First course \tab {\bfseries Nome}: \dotfill
     \tab Second course\tab {\bfseries Matricola}: \dotfill
     \tab Third Course \tab {\bfseries Documento}:  \dotfill
{\bfseries Codice del corso di laurea}: XXX
{\bfseries Materia}: XXXX
{\bfseries Data}: XXX 
{\bfseries Docente}: XXX
{\bfseries Durata}: 1.5 h + 10 minuti di lettura \tab {\bfseries Firma}: \hrulefill
\bigskip\bigskip
\rule{\textwidth}{1pt}}
\bigskip\bigskip
\begin{questions}
\question[10] What is this ?
\begin{solution} Another way. \end{solution}
\end{questions}
\end{document}

相关内容