带有小页面的表格,垂直对齐问题

带有小页面的表格,垂直对齐问题

我正在尝试在表格环境中对齐两个小页面,但是当我放置多个表格时会出现一些对齐问题,如下图所示。

\documentclass[10pt]{article}
\usepackage[hidelinks]{hyperref}
\usepackage{marvosym} % For cool symbols.
\newcommand{\cvreference}[7]{%
\textbf{#1}\newline% Name
\ifthenelse{\equal{#2}{}}{}{\addresssymbol~#2\newline}%
\ifthenelse{\equal{#3}{}}{}{#3\newline}%
\ifthenelse{\equal{#4}{}}{}{#4\newline}%
\ifthenelse{\equal{#5}{}}{}{#5\newline}%
\ifthenelse{\equal{#6}{}}{}{\emailsymbol~\texttt{#6}\newline}%
\ifthenelse{\equal{#7}{}}{}{\phonesymbol~#7}}

\begin{document}

\section*{References}

\begin{tabular}[t]{|c|c}
\begin{minipage}[t]{3in}
\textbf{Mr A}\\
AAA University\\
Somewhere\\
In the world\\
\Telefon\ +99 99 99 99 99 99\\
\Letter\ \href{mailto:[email protected]}{[email protected]}
\end{minipage}
&
\begin{minipage}[t]{3in}
\textbf{Mr B}\\
BBB University\\
Somewhere\\
In the world\\
\Telefon\ +99 99 99 99 99 99\\
\Letter\ \href{mailto:[email protected]}{[email protected]}
\end{minipage}
\end{tabular} \\ \\

\begin{tabular}[t]{|c|c}
\begin{minipage}[t]{3in}
\textbf{Mr C}\\
CCC University\\
Somewhere\\
In the world\\
\Telefon\ +99 99 99 99 99 99\\
\Letter\ \href{mailto:[email protected]}{[email protected]}
\end{minipage}
&
\begin{minipage}[t]{3in}
\textbf{Mr D}\\
DDD University\\
Somewhere\\
In the world\\
\Telefon\ +99 99 99 99 99 99\\
\Letter\ \href{mailto:[email protected]}{[email protected]}
\end{minipage}
\end{tabular}

\end{document}

在此处输入图片描述

你能帮我解决这个问题吗?

答案1

我假设你想获得这样的东西:

在此处输入图片描述

为此,您不需要minipage嵌套tabular。而是重新定义列类型,如下所示:

\documentclass[10pt]{article}
\usepackage{marvosym} % For cool symbols.
\usepackage{array}
\usepackage[hidelinks]{hyperref}
\newcommand{\cvreference}[7]{%
\textbf{#1}\newline% Name
\ifthenelse{\equal{#2}{}}{}{\addresssymbol~#2\newline}%
\ifthenelse{\equal{#3}{}}{}{#3\newline}%
\ifthenelse{\equal{#4}{}}{}{#4\newline}%
\ifthenelse{\equal{#5}{}}{}{#5\newline}%
\ifthenelse{\equal{#6}{}}{}{\emailsymbol~\texttt{#6}\newline}%
\ifthenelse{\equal{#7}{}}{}{\phonesymbol~#7}}

\newcolumntype{P}[1]{>{\raggedright\let\newline\\}p{#1}}
\begin{document}

\section*{References}
\begin{tabular}{|P{3in}|P{3in}}
\textbf{Mr A}   \\
AAA University  \\
Somewhere       \\
In the world    \\
\Telefon\ +99 99 99 99 99 99\\
\Letter\ \href{mailto:[email protected]}{[email protected]}
&
\textbf{Mr B}   \\
BBB University  \\
Somewhere       \\
In the world    \\
\Telefon\ +99 99 99 99 99 99\\
\Letter\ \href{mailto:[email protected]}{[email protected]}
                        \tabularnewline
\multicolumn{2}{c}{}    \tabularnewline[2ex]
\textbf{Mr C}   \\
CCC University  \\
Somewhere       \\
In the world    \\
\Telefon\ +99 99 99 99 99 99\\
\Letter\ \href{mailto:[email protected]}{[email protected]}
&
\textbf{Mr D}   \\
DDD University  \\
Somewhere       \\
In the world    \\
\Telefon\ +99 99 99 99 99 99\\
\Letter\ \href{mailto:[email protected]}{[email protected]}
\end{tabular}

\end{document}

答案2

您只是忘记了空白行开始一个新段落,因此第二个段落tabular应该由命令引入\noindent

p话虽如此,您的表格对于默认布局来说太宽了。另外,您为什么不使用或bX列类型之一呢?

\documentclass[10pt, table]{article}
\usepackage{showframe}
\renewcommand{\ShowFrameLinethickness}{0.3pt}
\usepackage[hidelinks]{hyperref}
\usepackage{marvosym} % For cool symbols.
\newcommand{\cvreference}[7]{%
\textbf{#1}\newline% Name
\ifthenelse{\equal{#2}{}}{}{\addresssymbol~#2\newline}%
\ifthenelse{\equal{#3}{}}{}{#3\newline}%
\ifthenelse{\equal{#4}{}}{}{#4\newline}%
\ifthenelse{\equal{#5}{}}{}{#5\newline}%
\ifthenelse{\equal{#6}{}}{}{\emailsymbol~\texttt{#6}\newline}%
\ifthenelse{\equal{#7}{}}{}{\phonesymbol~#7}}

\begin{document}

\section*{References}
\arrayrulecolor{red}
\begin{tabular}[t]{|c|c|}
\begin{minipage}[t]{3in}
\textbf{Mr A}\\
AAA University\\
Somewhere\\
In the world\\
\Telefon\ +99 99 99 99 99 99\\
\Letter\ \href{mailto:[email protected]}{[email protected]}
\end{minipage}
&
\begin{minipage}[t]{3in}
\textbf{Mr B}\\
BBB University\\
Somewhere\\
In the world\\
\Telefon\ +99 99 99 99 99 99\\
\Letter\ \href{mailto:[email protected]}{[email protected]}
\end{minipage}
\end{tabular} \\ \\

\noindent
\begin{tabular}[t]{|c|c}
\begin{minipage}[t]{3in}
\textbf{Mr C}\\
CCC University\\
Somewhere\\
In the world\\
\Telefon\ +99 99 99 99 99 99\\
\Letter\ \href{mailto:[email protected]}{[email protected]}
\end{minipage}
&
\begin{minipage}[t]{3in}
\textbf{Mr D}\\
DDD University\\
Somewhere\\
In the world\\
\Telefon\ +99 99 99 99 99 99\\
\Letter\ \href{mailto:[email protected]}{[email protected]}
\end{minipage}
\end{tabular}

\end{document} 

在此处输入图片描述

答案3

使用

 [...]
            \Letter\ \href{mailto:[email protected]}{[email protected]}
        \end{minipage}
    \end{tabular} \\[\bigskipamount]
%
    \begin{tabular}[t]{|c|c}
        \begin{minipage}[t]{3in}
            \textbf{Mr C}\\
[...]

并且也不像\\ \\表格中那样。

在此处输入图片描述

相关内容