With this code:
\documentclass{minimal}
\usepackage[a4paper,showframe]{geometry}
\begin{document}
\noindent
\sffamily
Foo\\
\fontsize{24}{24}\selectfont
Bar
\end{document}
I get this output:
How can I left align the two lines?
With this code:
\documentclass{minimal}
\usepackage[a4paper,showframe]{geometry}
\begin{document}
\noindent
\sffamily
Foo\\
\fontsize{24}{24}\selectfont
Bar
\end{document}
I get this output:
How can I left align the two lines?
TeX doesn't know the width of a glyph of a font. It only knows the width of the surrounding box. If you enclose the character in a \fbox
you can see, how much TeX knows about the two glyphs you want to align:
\documentclass{minimal}
\usepackage[a4paper,showframe]{geometry}
\fboxsep=-\fboxrule
\begin{document}
\noindent
\sffamily
\fbox{F}oo\\
\fontsize{24}{24}\selectfont
\fbox{B}ar
\end{document}
As you can see, the characters are aligned as far as TeX is concerned, therefore you'll have to align them manually, e.g. with:
\documentclass{minimal}
\usepackage[a4paper,showframe]{geometry}
\begin{document}
\noindent
\sffamily
Foo\\
\fontsize{24}{24}\selectfont
\hspace*{-0.12ex}Bar
\end{document}