我是 Latex 的新手,我正在尝试练习写简历。我想写一个部分,左边是句号,右边是我在这段时间里做过的事情。我想让句号与右侧部分的第一行对齐。
如您所见,“Period”与右侧部分没有完全对齐。此外,我想减少两个“块”(即“Period 1”块和“Period 2”块)之间的垂直间距,但我无法做到这一点。
以下是我使用的代码:
\parbox{0.26\textwidth}{
\textbf{Period 1}\\[2pt]
\hfill \\
\hfill
}
\parbox{0.74\textwidth}{
\begin{tabbing}
\hspace{2.45cm} \= \hspace{4cm} \= \kill
This is where I have studied in Period 1\\[2pt]
\emph{Thesis}\> This is my thesis work \\
\emph{Average grade} \> This is my average grade
\end{tabbing}
}
\parbox{0.26\textwidth}{
\textbf{Period 2}\\[2pt]
\hfill \\
\hfill \\
}
\parbox{0.74\textwidth}{
\begin{tabbing}
\hspace{2.45cm} \= \hspace{4cm} \= \kill
This is where I studied in Period 2 \\[2pt]
\emph{Thesis}\> This is my thesis work \\
\emph{Average grade} \> This is my average grade \\
\end{tabbing}
}
提前感谢大家!
答案1
使用该xcoffins
软件包,您可以以几乎与使用图形设计程序(当然没有 GUI)相同的方式设计您的简历。
https://ctan.org/pkg/xcoffins?lang=en
其概念背后的想法是将内容与页面元素的相对位置分开,以便于设计,例如封面。棺材只是带有多个手柄的盒子,可以在准确的\JoinCoffin
位置相互连接,例如第一个棺材的右下部分与另一个棺材的左上部分连接,依此类推。同时还可以添加水平或垂直偏移。
最后,它将 \TypesetCoffin
结果写入当前 LaTeX 插入点,通常位于文本区域左侧基线的底部。
在这种情况下,有七个棺材:时期、3 个固定标签(一个空白)和 3 个带有可变文本内容的标签。
因此,每个时期只需要更新四个棺材。其几何形状始终相同,但会根据内容的长度进行调整,同时保持规定的对齐方式。
必须先填满 4 个棺材,然后才能调用执行此操作的\SetVerticalCoffin
命令。\JoinAndPrintAll
这样,一旦确定了最终内容,就可以轻松地尝试更改几何形状,以实现更合适的设计。最后一张图片显示了这一点,其中添加了“Affiliation”一词,并且“Thesis”标签居中,并带有多行工作描述。
第三行添加了垂直蓝色规则,其高度等于全部内容加上 10pt。
正确的换行、对齐和连字均由神奇的 TeX 段落算法完成,无需人工干预,如较长的文本中所见。
\documentclass{article}
\usepackage{xcoffins}
\begin{document}
\setlength{\parindent}{0pt}
\NewCoffin\Pxi
\NewCoffin\TThx
\NewCoffin\TAvGx
\NewCoffin\AvGx
\NewCoffin\Wxi
\NewCoffin\Sxi
\NewCoffin\Fillx
\SetVerticalCoffin\TThx{0.25\textwidth}{\emph{Thesis}}
\SetVerticalCoffin\TAvGx{0.25\textwidth}{\emph{Average grade}}
\SetVerticalCoffin\Fillx{0.25\textwidth}{\phantom{\emph{Affiliation}}}
%\SetVerticalCoffin\Fillx{0.25\textwidth}{\emph{Affiliation}}
\newcommand{\JoinAndPrintAll}{%
\JoinCoffins\Pxi[r,B]\Fillx[l,B] %label blank
\JoinCoffins\Pxi[\Fillx-r,\Fillx-B]\Sxi[l,T] %affiliation
\JoinCoffins\Pxi[\Sxi-l,\Sxi-B]\TThx[l,t](-0.25\textwidth,-0.8\baselineskip) %label th
\JoinCoffins\Pxi[\TThx-r,\TThx-T]\Wxi[l,T] %work
\JoinCoffins\Pxi[\Wxi-l,\Wxi-B]\TAvGx[r,t](0pt,-0.8\baselineskip) %label av gr
\JoinCoffins\Pxi[\TAvGx-r,\TAvGx-T]\AvGx[l,T] %grade
\noindent\TypesetCoffin\Pxi
\vspace{2\baselineskip}
}
\SetVerticalCoffin\Pxi{0.25\textwidth}{Period 1}
\SetVerticalCoffin\Sxi{0.5\textwidth}{This is where I have studied in Period 1}
\SetVerticalCoffin\Wxi{0.5\textwidth}{This is my thesis work P1}
\SetVerticalCoffin\AvGx{0.5\textwidth}{This is my average grade P1}
\JoinAndPrintAll
\SetVerticalCoffin\Pxi{0.25\textwidth}{Period 2}
\SetVerticalCoffin\Sxi{0.75\textwidth}{School of Lost Objects \\ Faculty of Objetivity \\ Hard to Find University} \SetVerticalCoffin\Wxi{0.5\textwidth}{As any dedicated reader can clearly see, the Ideal of practical reason is a representation of, as far as I know, the things in themselves; as I have shown elsewhere, the phenomena should only be
used as a canon for our understanding. }
\SetVerticalCoffin\AvGx{0.5\textwidth}{A}
\JoinAndPrintAll
\SetVerticalCoffin\Pxi{0.25\textwidth}{Period 3}
\SetVerticalCoffin\Sxi{0.5\textwidth}{\raggedleft School of Amenities \\ Faculty of Everything \\ University of the Galaxy}
\SetVerticalCoffin\Wxi{0.5\textwidth}{The Ideal proves the validity of the objects in space and time. To avoid all misapprehension, it is necessary to explain that our judgements are a representation of, however, the manifold. }
\SetVerticalCoffin\AvGx{0.5\textwidth}{A+}
\JoinAndPrintAll
\end{document}
使用此代码获取第二个示例
\SetVerticalCoffin\Fillx{0.25\textwidth}{\emph{Affiliation}}
\newcommand{\JoinAndPrintAll}{%
\JoinCoffins\Pxi[r,B]\Fillx[l,B] %label blank
\JoinCoffins\Pxi[\Fillx-r,\Fillx-B]\Sxi[l,T] %affiliation
\JoinCoffins\Pxi[\Sxi-l,\Sxi-b]\Wxi[l,t](0pt,-0.8\baselineskip) %work
\JoinCoffins\Pxi[\Wxi-l,\Wxi-vc]\TThx[r,vc] % %label thesis
\JoinCoffins\Pxi[\Wxi-l,\Wxi-B]\TAvGx[r,t](0pt,-0.8\baselineskip) %label av gr
\JoinCoffins\Pxi[\TAvGx-r,\TAvGx-T]\AvGx[l,T] %grade
\noindent\TypesetCoffin\Pxi
\vspace{2\baselineskip}
}
或者更冒险的设置
使用此代码(添加calc
和xcolor
包)
\NewCoffin\Vrule
\SetVerticalCoffin\TThx{0.25\textwidth}{\emph{Thesis}}
\SetVerticalCoffin\TAvGx{0.25\textwidth}{\emph{Average grade}}
\SetVerticalCoffin\Fillx{0.25\textwidth}{\emph{Affiliation}}
\newcommand{\JoinAndPrintAll}{%
\JoinCoffins\Sxi[l,vc]\Fillx[r,vc]
\JoinCoffins\Wxi[l,vc]\TThx[r,vc]
\JoinCoffins\AvGx[l,vc]\TAvGx[r,vc]
\JoinCoffins\Sxi[l,b]\Wxi[l,t](0pt,-0.8\baselineskip)
\JoinCoffins\Sxi[l,b]\AvGx[l,t](0pt,-0.8\baselineskip)
\SetHorizontalCoffin\Vrule{\color{blue}\rule{2pt}{\CoffinTotalHeight\Sxi +10pt}}
\JoinCoffins\Pxi[r,vc]\Vrule[l,vc](-0.1\textwidth, 0pt)
\JoinCoffins\Sxi[l,vc]\Pxi[r,vc]
\noindent\TypesetCoffin\Sxi
\vspace{\baselineskip}
}
答案2
tabular
使用而不是 结合 更parbox
容易实现所需的输出tabbing
。
p{0.26\textwidth}
确保第一列的宽度为 0.26\textwidth,>{\bfseries}
自动将第一列中的所有条目变为粗体,同时>{\itshape}
确保第二列中的所有条目变为斜体。
请记住,tabularx
如果占位符文本的实际内容(例如“这是我的论文工作”)变得更长并且需要换行才能适应可用空间,则您必须更改代码(并使用固定宽度的列或)。
\documentclass{article}
\usepackage{array}
\begin{document}
\noindent
\begin{tabular}{>{\bfseries}p{0.26\textwidth}
>{\itshape}l
l}
Period 1 & \multicolumn{2}{l}{This is where I have studied in Period 1}\\
& Thesis & This is my thesis work \\
& Average grade & This is my average grade \\[10pt]
Period 2 & \multicolumn{2}{l}{This is where I have studied in Period 2}\\
& Thesis & This is my thesis work \\
& Average grade & This is my average grade \\
\end{tabular}
\end{document}
\documentclass{article}
\usepackage{tabularx}
\begin{document}
\noindent
\begin{tabularx}{\textwidth}{>{\bfseries}p{0.26\textwidth}
>{\itshape}l
X}
Period 1 & \multicolumn{2}{l}{This is where I have studied in Period 1}\\
& Thesis & This is my thesis work This is my thesis work This is my thesis work This is my thesis work This is my thesis work This is my thesis work This is my thesis work This is my thesis work This is my thesis work \\
& Average grade & This is my average grade \\[10pt]
Period 2 & \multicolumn{2}{l}{This is where I have studied in Period 2}\\
& Thesis & This is my thesis work \\
& Average grade & This is my average grade \\
\end{tabularx}
\end{document}