3

I am trying to align two minipages inside a tabular environment, but I have some alignment issues when I put more than one table, as you can see in the image at the bottom.

\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:mr.a@aaauniversity.com}{mr.a@aaauniversity.com}
\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:mr.b@bbbuniversity.com}{mr.b@bbbuniversity.com}
\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:mr.c@cccuniversity.com}{mr.c@cccuniversity.com}
\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:mr.d@ddduniversity.com}{mr.d@ddduniversity.com}
\end{minipage}
\end{tabular}

\end{document}

enter image description here

Could you help me to solve this problem?

2

I assume that you like to obtain something like this:

enter image description here

For this you not need minipage nested in tabular. Rather redefine columns type as follows:

\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:mr.a@aaauniversity.com}{mr.a@aaauniversity.com}
&
\textbf{Mr B}   \\
BBB University  \\
Somewhere       \\
In the world    \\
\Telefon\ +99 99 99 99 99 99\\
\Letter\ \href{mailto:mr.b@bbbuniversity.com}{mr.b@bbbuniversity.com}
                        \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:mr.c@cccuniversity.com}{mr.c@cccuniversity.com}
&
\textbf{Mr D}   \\
DDD University  \\
Somewhere       \\
In the world    \\
\Telefon\ +99 99 99 99 99 99\\
\Letter\ \href{mailto:mr.d@ddduniversity.com}{mr.d@ddduniversity.com}
\end{tabular}

\end{document}
3

You only forgot that a blank lines starts a new paragraph, so the second tabular should be introduced by a \noindent command.

That being said, your tables are too wide for the default layout. Also, why don't you use one of the p or b or X column types?

\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:mr.a@aaauniversity.com}{mr.a@aaauniversity.com}
\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:mr.b@bbbuniversity.com}{mr.b@bbbuniversity.com}
\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:mr.c@cccuniversity.com}{mr.c@cccuniversity.com}
\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:mr.d@ddduniversity.com}{mr.d@ddduniversity.com}
\end{minipage}
\end{tabular}

\end{document} 

enter image description here

1

Use

 [...]
            \Letter\ \href{mailto:mr.b@bbbuniversity.com}{mr.b@bbbuniversity.com}
        \end{minipage}
    \end{tabular} \\[\bigskipamount]
%
    \begin{tabular}[t]{|c|c}
        \begin{minipage}[t]{3in}
            \textbf{Mr C}\\
[...]

and also not something like \\ \\ in a tabular.

enter image description here

1
  • What should be done instead of \\ \\ in a tabular? I ask because (in a different situation) I had the top of the contents in one row extending higher than it should, and overlapping the previous row. Some suggestions I found here in Tex.SE failed because they entailed knowing the height of one of the rows, then hard-coding it. But \\[-2mm] \\ did the trick.
    – Rosie F
    Jun 22 '19 at 21:04

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.