2

Why do I have this misalignment of the table respect to the section title? How can I get rid of it?

enter image description here

\documentclass{article}


\begin{document}
\section{Education}

\vspace{\baselineskip}

\begin{tabular}{rl}
\textsc{4.0 GPA} & \textbf{Undergraduate} \\ 
                 & \textsc{Natural Sciences} \\ 
                 & \textit{University of California, Berkeley}
\end{tabular}

\vspace{\baselineskip}

\section{Classes Taken}

\vspace{\baselineskip}
\end{document}
2
  • 2
    Congrats on the GPA :) -- Next time please include the \documentclass, \begin{document} and \end{document}. Jan 13, 2015 at 17:53
  • @AndrewCashner Wow I'm so sorry I was sure to have provided a complete MWE. I've just copied and pasted the code. I don't know what happened! Anyway, thank you!
    – Aurelius
    Jan 13, 2015 at 18:16

2 Answers 2

4

The tabular environment by default inserts a small amount of horizontal space to the left of the first column. You can control the space between columns with the argument of @{} in the tabular preamble. Putting nothing there removes the space and solves your problem.

\begin{tabular}{@{}rl}
\textsc{4.0 GPA} & \textbf{Undergraduate} \\ 
                 & \textsc{Natural Sciences} \\ 
                 & \textit{University of California, Berkeley}
\end{tabular}
4

1. if you are not going to insert contents between \section{} and tabular (I mean, if the tabular is the first non empty line) you don't need \noindent.

Otherwise, the second paragraph (the tabular) will be indented and you have to remove it using \noindent.

2. As cited by @Andrew Cashner, you have to remove the empty space at the beginning of the cell making use of {@{}rl}.

enter image description here

MWE

\documentclass{report}  

\begin{document}

\section{Education}

First line here without \verb|\noindent|

\vspace{\baselineskip}

%   \noindent
    \begin{tabular}{@{}rl}
        \textsc{4.0 GPA} & \textbf{Undergraduate} \\ 
        & \textsc{Natural Sciences} \\ 
        & \textit{University of California, Berkeley}
    \end{tabular}

\section{Education}

First line here with \verb|\noindent|

\vspace{\baselineskip}

\noindent %
\begin{tabular}{@{}rl}
    \textsc{4.0 GPA} & \textbf{Undergraduate} \\ 
    & \textsc{Natural Sciences} \\ 
    & \textit{University of California, Berkeley}
\end{tabular}


\end{document}
2
  • 2
    It's only the @{} setting, not the alignment, that causes the problem. Jan 13, 2015 at 17:52
  • @AndrewCashner, you are right. I edited. Thanks.
    – Sigur
    Jan 13, 2015 at 18:02

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .