[texhax] How to put space characters at the beginning of a line?

Robin Fairbairns Robin.Fairbairns at cl.cam.ac.uk
Tue Apr 27 17:59:12 CEST 2010


José Romildo Malaquias <j.romildo at gmail.com> wrote:

> I need to put space characters at the beginning of a line in a LaTeX
> document. The problem is that neither '~' nor '\ ' works to achieve this
> behaviour.
> 
> See the simplified document that illustrates the problem:
> 
>    \documentclass[a4paper]{article}
> 
>    \begin{document}
> 
>    \ttfamily\frenchspacing\noindent
>    First~line\newline
>    ~~Second~line
> 
>    \end{document}
> 
> Note that, when this document is compiled, the letter 'S' in the last
> line aligns to the letter 'F' in the previous line. How can I get this
> 'S' aligned to the 'r' front the previous line?
> 
> This problem should be solved without using the verbatim (or similar)
> environment.

so you want verbatim without the verbatim environment, but don't explain
what you don't like about the environment.

how about copying the code of the verbatim environment?

verbatim text in tex is notoriously tricky, which is why the verbatim
environment is so complicated.  there are various scraps of verbatim
code on the macros/plain and macros/generic trees on ctan; iirc there's
one in the texbook, too.  all those that work will have essentially the
same code as the verbatim environment.  (the \obeyspaces, \obeylines stuff.)

robin



More information about the texhax mailing list