# Start a line at X column

How can I write a line of text at a given column? I'm using a monospace font and I have interest in how can I can specify a column number to start from there. For example:

Line started at column zero
Line started at column five
Line started at column nine


I only found how to specify an horizontal space in LaTeX units but not in columns. This question comes to my mind playing with a code chunk that I have in a listing environment from where I found that I could insert normal text at an exact column position

\begin{listing}
|@Efectively this line start at five position@|
\end{listing}


The |@ and@| are my escape characters. Then I ask myself can I do the same without listing?

-

You can use the tabbing environment for this:

\documentclass{article}
\begin{document}
\ttfamily
\begin{tabbing}
\hspace{1em}\=\hspace{1em}\=\hspace{1em}\=\hspace{1em}
\kill
This is at the right margin\\
\>This is at the first tab stop\\
\>\>This is at the second tab stop\\
\>\>\>This is at the third tab stop\\
\end{tabbing}
\end{document}


-
Is 1em exactly two tt-font characters wide? It looks like it from your image. –  Martin Scharrer May 17 '11 at 23:53

A rudimentary version of a command allowing you to specify the indentation as a value depending on the width of a character in mono-spaced font:

\documentclass{article}

\newlength\mylen
\settowidth\mylen{\texttt{n}}
\newcommand\StCol[2][0]{{\ttfamily\noindent\hspace*{#1\mylen}{#2}}}

\begin{document}

\StCol{Line started at column zero}\\
\StCol[4]{Line started at column five}\\
\StCol[8]{Line started at column nine}

\end{document}


-
The \settowidth should be in the \StCol macro so that different font sizes are taken into account. Alan Munn's answer makes me think that .5em is one tt-font character wide. If this is the case #1\mylen count be replaced by #1\dimexpr .5em\relax. –  Martin Scharrer May 17 '11 at 23:55