3

I want two miniboxes side to side, for my CV. I notice the one on the right is a bit off, despite both having (almost) the same format and number of lines.

The "only" difference, I thought, is that the left one uses three "hard" line breaks (paragraphs), whereas the one on the right uses one paragraph over three lines.

However, when I was constructing the MWE, I discovered that the actual problem is from the accented character É which moves the text on the left box a bit down.

How can I make the two be perfectly aligned ?

Minimal working example image

MWE:

\documentclass[11pt,a4paper]{article}

\usepackage{lmodern}        % use modern latin fonts
\usepackage[T1]{fontenc}    % use 8 bit output font encoding with more glyphs
\usepackage[utf8]{inputenc} % so you can type 
\usepackage[margin=1.6cm]{geometry}
\usepackage[explicit]{titlesec}        % to remove space after section


\titleformat{\section}          % what to format
  {\normalfont\large\bfseries}  % how to format the text
  {\thesection}                 % what label to use (number)
  {1em}                         % how much space after label
  {#1}                          % code before the text; #1 is the text
  [{\titlerule[1pt]}]           % code after the text
% \titlespacing*{\command}{left}{before}{after}[right]
\titlespacing*{\section}{0pt}{0pt}{0.3em}


\setlength{\parskip}{0.5em}  % less space after paragraph
\setlength{\parindent}{0pt}  % avoid auto indentation
\pagestyle{empty}            % Produces empty heads and feet - no page numbers


%% ============================================================================

\begin{document}

\begin{minipage}[t]{0.48\textwidth}
\section*{Education}
  \textbf{École Awesome University 2}\par
  MSc BlaBla -- 0.0 avg. -- 2018\par
  BlaBla Bla Bla Bla

  \bigbreak
  \textbf{École Awesome University 1}\par
  BSc TraLaLa -- 110\% avg. -- 2016\par
  Latex \& stuff plus some other stuff -- Top 5
\end{minipage}
\quad
\begin{minipage}[t]{0.48\textwidth}
  \section*{Personal}
  \hspace{1.5em} I am super motivated to learn why this two miniboxes are unaligned. This introduction should have about three lines, to look nicely.\par

  \bigbreak
  \textbf{I can:} Duuh\par
  \textbf{Languages:} English -- ok \quad | \quad Latex -- meh\par
  \textbf{Availability:} in the future
\end{minipage}


\end{document}
2

The problem is titlesec. It redefines section in a way that it changes the spacing. Imho the easiest to get around it is to use a \vphantom (the \tikz are only there to show the alignment):

\documentclass[11pt,a4paper]{article}

\usepackage{lmodern}        % use modern latin fonts
\usepackage[T1]{fontenc}    % use 8 bit output font encoding with more glyphs
\usepackage[utf8]{inputenc} % so you can type
\usepackage[margin=1.6cm]{geometry}
\usepackage[explicit]{titlesec}        % to remove space after section


\titleformat{\section}          % what to format
  {\normalfont\large\bfseries}  % how to format the text
  {\thesection}                 % what label to use (number)
  {1em}                         % how much space after label
  {#1}                          % code before the text; #1 is the text
  [{\titlerule[1pt]}]           % code after the text
% \titlespacing*{\command}{left}{before}{after}[right]
\titlespacing*{\section}{0pt}{0pt}{0.3em}


\setlength{\parskip}{0.5em}  % less space after paragraph
\setlength{\parindent}{0pt}  % avoid auto indentation
\pagestyle{empty}            % Produces empty heads and feet - no page numbers


%% ============================================================================
\usepackage{tikz}
\begin{document}

\begin{minipage}[t]{0.48\textwidth}
\section*{Education}
  \tikz[overlay]\draw[red](0,0)--++(2\textwidth,0);\textbf{École Awesome University 2}\par
  MSc BlaBla -- 0.0 avg. -- 2018\par
  BlaBla Bla Bla Bla

  \bigbreak
  \textbf{École Awesome University 1}\par
  BSc TraLaLa -- 110\% avg. -- 2016\par
  \tikz[overlay]\draw[red](0,0)--++(2\textwidth,0);Latex \& stuff plus some other stuff -- Top 5
\end{minipage}
\quad
\begin{minipage}[t]{0.48\textwidth}
  \section*{Personal}
  \leavevmode\vphantom{\textbf{É}}\hspace{1.5em}I am super motivated to learn why this two miniboxes are unaligned. This introduction should have about three lines, to look nicely.\par

  \bigbreak
  \textbf{I can:} Duuh\par
  \textbf{Languages:} English -- ok \quad | \quad Latex -- meh\par
  \textbf{Availability:} in the future
\end{minipage}


\end{document}

enter image description here

| improve this answer | |
  • maybe it wouldn't work all the time, but wouldn't \strut do as well here? – barbara beeton Oct 22 '17 at 21:07
  • @barbarabeeton: Not here. I tried ;-). – Ulrike Fischer Oct 22 '17 at 21:09
  • thanks. would be interesting to know why. (strut redefined somewhere? or strut actually too tall?) – barbara beeton Oct 22 '17 at 21:12
  • @barbarabeeton The bold É is a bit higher (9.95354pt) than a \strut (9.51996pt). So the bold É pushes the line more down. – Ulrike Fischer Oct 22 '17 at 21:36

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.