0

This is a MWE of a section title I'm trying to define in a large project.

\documentclass[a2,portrait]{a0poster}

\usepackage{tikz}

% Blue section, large, text on next line.
\def\Lsect#1{\noindent\hbox to \hsize{\large\color{blue} #1}\bigskip}

\begin{document}

\Lsect{This is a title}

Some text.

\end{document}

and this is the output:

enter image description here

I've stripped the LaTeX file of every non-essential line to reproduce the issue (I'm not sure why tikz needs to be there though)

I need to have the title correctly aligned to the left and I just can't figure out how to do that, I've tried every modification the the definition I could think of.

  • 1
    \def\Lsect#1{\noindent\hbox to \hsize{\large\color{blue} #1\hfill}\bigskip} or \def\Lsect#1{\noindent\hbox{\large\color{blue} #1}\bigskip} – Henri Menke May 8 '14 at 12:26
  • The second line is not what I need since the text is written on the same line as the title. The first one works perfectly, would you mind putting is as an answer so I can mark it as accepted? – Gabriel May 8 '14 at 12:46
2

If you specify an hbox to a certain size, TeX will try to fit the contents to that size. If want to align the content to a certain direction, try one of the following rubber lengths:

  • \hfil, \hfill or \hfilll
  • \hss

\documentclass[a2,portrait]{a0poster}
\usepackage{tikz}
% Blue section, large, text on next line.
\def\Lsect#1{\noindent\hbox to \hsize{\large\color{blue} #1\hfil}\bigskip}
\begin{document}
\Lsect{This is a title}
Some text.
\end{document}

enter image description here

|improve this answer|||||

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.