2

so I have this problem that I have a multicolumn setup and I have two columns. I specified the first column to be left centered and the second column to be 10.5 cm long. I don't understand why the second column in all three sections are not aligned underneath each other.

I'm not sure how to create a minimal working example - here is my code:

\documentclass[a4paper,11pt]{article} % Default font size and paper size

\usepackage{fontspec}
\defaultfontfeatures{Mapping=tex-text}
\setmainfont[SmallCapsFont = Fontin SmallCaps]{Fontin} % Main document font

\usepackage{xunicode,xltxtra,url,parskip} % Formatting packages
\usepackage{graphicx,tabularx,lipsum}
\usepackage{fancyhdr}
\usepackage[usenames,dvipsnames]{xcolor} % Required for specifying custom colors
\usepackage[german]{babel}
\usepackage{setspace}

\usepackage[big]{layaureo} % Margin formatting of the A4 page, an alternative to layaureo can be \usepackage{fullpage}
% To reduce the height of the top margin uncomment: \addtolength{\voffset}{-1.3cm}

\usepackage{hyperref} % Required for adding links and customizing them
\definecolor{linkcolour}{rgb}{0,0.2,0.6} % Link color
\hypersetup{colorlinks,breaklinks,urlcolor=linkcolour,linkcolor=linkcolour} % Set link colors throughout the document

\usepackage{titlesec} % Used to customize the \section command
\titleformat{\section}{\Large\scshape\raggedright}{}{0em}{}[\titlerule] % Text formatting of sections
\titlespacing{\section}{0pt}{3pt}{3pt} % Spacing around sections

\fancyhf{}
\renewcommand{\headrulewidth}{0pt}
\fancyfoot[R]{{\footnotesize \textit{Stand: \today}}}
\fancyfoot[C]{\thepage}
\pagestyle{fancy}

\begin{document}

%----------------------------------------------------------------------------------------
%   NAME AND CONTACT INFORMATION
%----------------------------------------------------------------------------------------
%\includegraphics[scale=.3]{fd.jpg}
\newlength{\oldparindent} \setlength{\oldparindent}{\parindent}
\setbox0=\hbox{}
\noindent \begin{tabularx}{\textwidth}{@{}Xc@{}}
  \hskip\oldparindent \par{{\Huge My \textsc{Name}}\bigskip\par} {\large Curriculum Vitae} & \raisebox{-\ht0}{\usebox0}% \\
\end{tabularx}
\vskip 40pt

\section{Personal Data}

\begin{tabular}{lp{10.5cm}}
\textsc{born:} & \hspace{0.6cm} Birthday \\
\textsc{Nationality:} & \hspace{0.6cm} Deutsch, US-Amerikanisch\\
\textsc{Family:} & \hspace{0.6cm} Ledig\\
\textsc{Adress:} & \hspace{0.6cm} my street, my postcode, my town\\
\textsc{Telefon:} & \hspace{0.6cm} my phone number\\
\textsc{Mail:} & \hspace{0.6cm} my mail adress\\
\end{tabular}
%----------------------------------------------------------------------------------------
%   EDUCATION
%----------------------------------------------------------------------------------------
\section{Education}
\begin{tabular}{lp{10.5cm}}
\textsc{Okt 2012 - Sep 2015} & Master of Arts\\
& University\\
& \footnotesize{Thesis: "`Title of Thesis"'}\\
\multicolumn{2}{c}{}\\
%------------------------------------------------
\textsc{Okt 2007 - Sep 2011} & Bachelor of Science\\
& University\\
& \footnotesize{Thesis: "`Title of Thesis"'}\\
\multicolumn{2}{c}{}\\
%------------------------------------------------
\textsc{Okt 1995 - Aug 2005} & Highschool\\
& Town of Highscool, City\\
& \footnotesize{Highschool diploma}\\
\multicolumn{2}{c}{}\\
\end{tabular}

%----------------------------------------------------------------------------------------
%   ACADEMIC WORK EXPERIENCE
%----------------------------------------------------------------------------------------
\section{Work Experience}
\begin{tabular}{lp{10.5cm}} 
\textsc{Since Apr 2016} & Research Associate\\
& Institut for Research\\
& \footnotesize{Projekt 1 (LALA): Here I did a lot of things. Like lalala and some more lalala. Here I did a lot of things. Like lalala and some more lalalaHere I did a lot of things. Like lalala and some more lalalaHere I did a lot of things. Like lalala and some more lalalaHere I did a lot of things. Like lalala and some more lalalaHere I did a lot of things. Like lalala and some more lalala}\\
& \footnotesize{Specific tasks: Here I did a lot of things. Like lalala and some more lalalaHere I did a lot of things.}\\[0.5 cm]
& \footnotesize{Projekt 2 (LULU): Here I did a lot of things. Like LULU and some more lululu. Here I did a lot of things. Like LULU and some more lululu.Here I did a lot of things. Like LULU and some more lululu.Here I did a lot of things. Like LULU and some more lululu.Here I did a lot of things. Like LULU and some more lululu.Here I did a lot of things. Like LULU and some more lululu}\\
& \footnotesize{Specific tasks: Here I did a lot of things. Like LULU and some more lululu.Here I did a lot of things.}\\
\multicolumn{2}{c}{}\\
\end{tabular}
\end{document}
  • 1
    Just because you don't fix left column width. As they use their natural width, right columns are not vertically aligned. – Ignasi Jan 9 '17 at 18:13
2

The answer to your problem is rather easy.

You defined a table with

\begin{tabular}{lp{10.5cm}}

This results in a table with two columns. The first column will be left justified, while the second column will be justified on both sides.

Another important difference is, that the width of the second column is fixed to 10.5 cm but the width of the first column depends on the longest entry of that table. That is: in you first section "Personal Data", the word "Nationality" is clearly the longest entry in the first column. In the second table in section "Education" each entry is more or less similar wide. But they are wider than the length of "Nationality" ...

You should define a similar table for each section, using two p{width}-columns, in order to avoid that problem of yours. I defined a v-column for you. Of course, I/you have to care about the width of the first column. I think, my guess of 3cm is a bit to narrow. Luckily, you can change it in the preamble and it affects all those tables.

You have to load the array-package, to use this trick.

You should also define the table in that way, that \textsc is always defined for the complete first column, instead of repeating it row by row. You can do that by defining >{\scshape\selectfont}l as your first column. I did that in the new v-column, too.

Last but not least, you may want to use commands like \raggedright and \raggedleft in order to manipulate the p-columns. Normally those p-columns are justified on the left and the right side, which is---especially in narrow columns---a bad idea. You asked for a flush right margin for the first column and a flush left second column. By loading the ragged2e-package and using its \RaggedLeft and \RaggedRight-commands, you are now able, to have line wrapping not only between words, but also in the words itself.

One word to the line wrapping inside of the table cells. Usually the double backslash (\\) will start a new table row. Thus you can not use it to also start a newline in the table cell. Use regular \newline in your cells, instead of starting a complete new line and leaving the first column empty.

You don't have to specify an newline-command (\\) at the end of the last line of a table.

If you want to separate two rows in a table, better use \\[height of gap], I removed your \multicolumn and replaced it by \\[1.5ex].

Another typographical hint: the german Duden says, you have to use the endash (-- in input) as "Von-Bis-Strich". Your entries should therefore be typed as October 2016--December 2016 (at least for a german document).

You MWE could look like this

\documentclass[a4paper,11pt]{article} % Default font size and paper size
\usepackage[german]{babel}
\usepackage{array}
\usepackage{ragged2e}


%% Define a new columntype, in this case having two columns.
\newcolumntype{v}{@{}
  >{\RaggedLeft\arraybackslash\scshape\selectfont}p{3cm} 
  >{\RaggedRight\arraybackslash}p{10.5cm} @{}}

\begin{document}
\section{Personal Data}

\begin{tabular}{v}
born: &  Birthday \\
Nationality: &  Deutsch, US-Amerikanisch\\
Family: &  Ledig\\
Adress: &  my street, my postcode, my town\\
Telefon: &  my phone number\\
Mail: &  my mail adress
\end{tabular}

\section{Education}
\begin{tabular}{v}
Okt 2012--Sep 2015 & Master of Arts\newline 
                     University\newline 
                     Thesis: "`Title of Thesis"'\\[1.5ex]
Okt 2007--Sep 2011 & Bachelor of Science\newline 
                     University\newline 
                     Thesis: "`Title of Thesis"'\\[1.5ex]
  Okt 1995--Aug 2005 & Highschool\newline
                       Town of Highscool, City\newline
                       Highschool diploma
\end{tabular}
\end{document}

Result will be: enter image description here

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.