为什么重音字符会搞乱对齐?

为什么重音字符会搞乱对齐?

我想要两个并排的小方框,用于放置我的简历。我注意到右边的那个有点不对劲,尽管它们的格式和行数(几乎)相同。

我认为,“唯一”的区别在于左边使用三个“硬”换行符(段落),而右边使用三行一个段落。

然而,当我构建 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}

答案1

问题在于 titlesec。它以改变间距的方式重新定义了部分。我认为最简单的解决方法是使用 \vphantom(\tikz 仅用于显示对齐方式):

\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}

在此处输入图片描述

相关内容