0

I use the same latex for two piece of information, but the output alignment is a bit different:

Syntax:

\noindent \textbf{Udacity} \hfill Machine Learning Nanodegree \hfill Aug. 2014 -- Sept. 2015\linebreak

\noindent \textbf{Singapore Management University} \hfill M.S. in Data Management and Analytics \hfill Aug. 2014 -- Aug. 2015

Output enter image description here

  • Welcome to TeX.SX! Each \hfill gets replace by the same amount to fill the available space horizontally. That's why your alignment seems odd. You can mark code using the "{}" buttom in the editor or by indenting it with 4 spaces. You should really post a complete compilable MWE, beginning at \documentclass and ending at \end{document}, including all that is necessary to produce your output/issue. – Skillmon Aug 18 '17 at 8:00
1

I think the easiest way to accomplish the alignment isn't using \hfill but a tabular or tabularx environment:

\documentclass[]{article}

\usepackage{geometry}
\usepackage{array}
\usepackage{tabularx}

\begin{document}
\noindent
\begin{tabularx}{\linewidth}{
        @{}
        >{\bfseries}X
        >{\centering}X
        r
        @{}}
    ~\textsc{Education}\\
    \hline
    Udacity & Machine Learning Nanodegree & Aug. 2014 -- Sept. 2015\cr
    Singapore Management University & M.S. in Data Management and Analytics & Aug.
    2014 -- Aug. 2015\\
\end{tabularx}

\end{document}

enter image description here

  • but please make entries in the first column ragged right. – barbara beeton Aug 18 '17 at 13:50
0

I'm not sure where you see the problem but if it is the end of the line:

\linebreak does something different to a paragraph break. Set \parfillskip to 0pt and use either \par or \\ to separate both:

{%
 \parfillskip=0pt
 \noindent \textbf{Udacity} \hfill 
 Machine Learning Nanodegree \hfill 
 Aug. 2014 -- Sept. 2015
 \par %or \\ here    
 \noindent \textbf{Singapore Management University} \hfill 
  M.S. in Data Management and Analytics \hfill 
  Aug. 2014 -- Aug. 2015
 \par %important.
}

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.