我开始学习 latex 并用它来准备简历。我使用 longtable 来组织简历,以便定义不同文本块的宽度和对齐方式,这给了我很好的经验。
在我的示例中,长表仅包含一行和两列。此外,每个单元格包含一个小页面,而小页面本身又包含另一个表格。
两列中的小页面以某种方式相互影响。我在右侧表格中插入的行越多,左侧小页面移动得越远。当然,我希望两列 longtable 中的小页面固定在最顶部。这仅在小页面中使用表格时才会发生。使用普通文本时,小页面仍位于顶部。
\documentclass[11pt]{article}
\RequirePackage[quiet]{fontspec}
\newfontfamily\body[]{HelveticaNeue-Light}
\newfontfamily\thinfont[]{HelveticaNeue-Light}
\newfontfamily\bold[]{HelveticaNeue-Medium}
\newfontfamily\headingfont[]{Helvetica Neue}
\newfontfamily\ultralight[]{HelveticaNeue-UltraLight}
\setmainfont[Mapping=tex-text, Color=textcolor]{HelveticaNeue-Light}
\usepackage{geometry}
\geometry{
a4paper,
total={210mm,297mm},
left=0mm,
right=0mm,
top=0mm,
bottom=20mm,
}
\usepackage{longtable}
\usepackage{lipsum}
\usepackage[ngerman]{babel}
\usepackage{graphicx}
\usepackage{soul}
\usepackage{colortbl}
\definecolor{Gray}{gray}{0.4}
\definecolor{mygreen}{RGB}{102,204,0}
\definecolor{myblue}{RGB}{64,64,64}
\definecolor{mybluetwo}{RGB}{222,231,241}
\definecolor{myred}{RGB}{144,53,41}
%outer longtable
\newcolumntype{A}{>{}p{0.15\paperwidth}}
\newcolumntype{B}{>{}p{0.70\paperwidth}}
\begin{document}
\pagenumbering{gobble}
%Headline
\noindent\fcolorbox{myblue}{myblue}{%
\begin{minipage}[c][4cm]{\paperwidth}
\sodef\spaceout{}{0.25em}{0.9em}{1pt}
\begin{center}
\begin{tabular}{c}
%\Huge\textcolor{mygreen}{{\makebox[\linewidth][c]{\ultralight\spaceout{Firstname}\bold\spaceout{ name}}}}\\
\Huge\textcolor{mygreen}{\ultralight firstname \bold name}\\
\textcolor{mygreen}{* * *} \\
\Large\textcolor{mygreen}{\ultralight curriculum vitae}\\
\end{tabular}
\end{center}
\end{minipage}}%
\begin{longtable}{|A|B|}
\fbox{
\begin{minipage}[t][6cm]{0.14\paperwidth}
\begin{tabular}{|p{0.12\paperwidth}|}
Left Table\\
left Table\\
\end{tabular}
\end{minipage}}
&
\fbox{
\begin{minipage}[t][16cm]{0.69\paperwidth}
\begin{tabular}{|p{0.66\paperwidth}|}
Right Table\\
Right Table\\
Right Table\\
Right Table\\
Right Table\\
Right Table\\
Right Table\\
Right Table\\
Right Table\\
\end{tabular}
\end{minipage}}
\\
\end{longtable}
\end{document}
答案1
[t]
您不仅需要将定位说明符添加到minipage
环境中,还需要添加到两个tabular
环境中。
%% preamble stuff omitted
\begin{longtable}{|A|B|}
\fbox{
\begin{minipage}[t][6cm]{0.14\paperwidth}
\begin{tabular}[t]{|p{0.12\paperwidth}|} % <--- "[t]" is new
Left Table\\
left Table\\
\end{tabular}
\end{minipage}}
&
\fbox{
\begin{minipage}[t][16cm]{0.69\paperwidth}
\begin{tabular}[t]{|p{0.66\paperwidth}|} % <--- "[t]" is new
Right Table\\
Right Table\\
Right Table\\
Right Table\\
Right Table\\
Right Table\\
Right Table\\
Right Table\\
Right Table\\
\end{tabular}
\end{minipage}}
\\
\end{longtable}