答案1
除了这里的答案之外,我认为实现您想要的最灵活的方法是使用\minipage
环境并应用于\flushright
文本。
\documentclass{article}
\usepackage[a4paper,margin=2cm]{geometry}
%\usepackage{minipage}
\begin{document}
\noindent \begin{minipage}{0.32\textwidth}
\textbf{Carnegie Mellon University}
\textbf{Tsinghua University}
\end{minipage}%
\begin{minipage}{0.35\textwidth}
\begin{flushright}
LTI, School of Computer Science
School of Software
\end{flushright}
\end{minipage}\hfill
\begin{minipage}{0.30\textwidth}
\begin{flushright}
July 2008 -- Present
July 2008 -- Present
\end{flushright}
\end{minipage}
\end{document}
答案2
您可以使用tabular*
并array
以“集中”的方式设置格式:
\documentclass{article}
\usepackage[a4paper,margin=2cm]{geometry}
\usepackage{array}
\begin{document}
\noindent
\begin{tabular*}{\textwidth}{
@{\extracolsep{\fill}}
>{\bfseries}l
r
>{\itshape}r
@{}
}
Carnegie Mellon University & LTI, School of Computer Science & July 2008 -- Present \\
Tsinghua University & School of Software & July 2008 -- Present
\end{tabular*}
\end{document}
我使用它是geometry
因为标准article
文本宽度对于这个表来说太小了。
答案3
一个好的选择是使用表格:
在您的文档中尝试此操作
\begin{tabular}{l r r}
\textbf{ Carnegie Mellon University} & {LTI, School of Computer Science} &\textit{ July 2008 - Present}\\
\textbf{ Tsinghua University} &{School of Software} & \textit{ July 2008 - Present}\\
\end{tabular}
这是使用 tabularx 的更新
\documentclass[a4paper,10pt]{article}
\usepackage[a4paper, total={7in, 8in}]{geometry}
\usepackage[utf8]{inputenc}
\usepackage{tabularx}
\newcolumntype{L}{>{\raggedright\arraybackslash}X}%
\newcolumntype{R}{>{\raggedleft\arraybackslash}X}%
\begin{document}
\noindent
{\bf Carnegie Mellon University} \hfill {LTI, School of Computer Science} \hfill {\em July 2008 - Present}\\
{\bf Tsinghua University} \hfill {School of Software} \hfill {\em July 2008 - Present}\vspace*{20pt}
\noindent\begin{tabularx}{\linewidth}{L R R}
\textbf{ \mbox{Carnegie Mellon University}} & {\mbox{LTI, School of Computer Science}} &\textit{ July 2008 - Present}\\
\textbf{ Tsinghua University} &{School of Software} & \textit{ July 2008 - Present}\\
\end{tabularx}
\end{document}
编辑以包含第一行和最后一行之间的文本:代码:
\documentclass[a4paper,10pt]{article}
\usepackage[a4paper, total={7in, 8in}]{geometry}
\usepackage[utf8]{inputenc}
\usepackage{tabularx}
\newcolumntype{L}{>{\raggedright\arraybackslash}X}%
\newcolumntype{R}{>{\raggedleft\arraybackslash}X}%
\begin{document}
Your old code:
\noindent
{\bf Carnegie Mellon University} \hfill {LTI, School of Computer Science} \hfill {\em July 2008 - Present}\\
{\bf Tsinghua University} \hfill {School of Software} \hfill {\em July 2008 - Present}\vspace*{20pt}
My updated code
\noindent\begin{tabularx}{\linewidth}{L R R}
\textbf{ \mbox{Carnegie Mellon University}} & {\mbox{LTI, School of Computer Science}} &\textit{ July 2008 - Present}\\
\multicolumn{3}{p{\linewidth}}{Here you can have any possible content that can break in several lines without
causes any problem to the alligned first and last lines\ldots Be carefullldots you need to use p\verb|\linewidth|
to have this kind of line between the others!}\\
\textbf{ Tsinghua University} &{School of Software} & \textit{ July 2008 - Present}\\
\end{tabularx}
\end{document}
使用 minipage 和 itemize 进行更新:
My updated code:\vspace*{10pt}
\noindent\begin{tabularx}{\linewidth}{L R R}
\textbf{ \mbox{Carnegie Mellon University}} & {\mbox{LTI, School of Computer Science}} &\textit{ July 2008 - Present}\\
\\
\multicolumn{3}{p{\linewidth}}{
\begin{minipage}{\linewidth}
\begin{itemize}
\item Test item one
\item Test second longer item
\item These items have nothing to do with the rest alligned tabular...
\end{itemize}
\end{minipage}}\\
\\
\textbf{ Tsinghua University} &{School of Software} & \textit{ July 2008 - Present}\\
\end{tabularx}