LaTeX is a high-quality open source typesetting software that produces professional prints and PDF files.
In this LaTeX tutorial, taken from by LaTeX Beginner’s Guide, you’ll learn how to line up text and data in columns and typeset complex tables.
(For more resources on this subject, see here.)
Remember the time of the typewriter and early word processing software? When we needed to line up some text in columns, we could use tab stops. LaTeX provides a similar way to easily align text in columns, namely, the tabbing environment.
We would like to present a quick overview regarding LaTeX. We shall present one point on each line, aligned at words and double colons:
documentclass{article}
begin{document}
begin{tabbing}
emph{Info:} = Software = : = LaTeX \
> Author > : > Leslie Lamport \
> Website > : > www.latex-project.org
end{tabbing}
end{document}
The tabbing environment that we used begins a new line. We used three simple tags for markup:
This way, we can quickly produce columns containing left-aligned text. If the rows of the tabbing environment would reach the end of a page, it could continue on the next page. What if a column is too long, running over the tab stop? Let’s see how to solve that.
Now we shall create a table:
documentclass{article}
newcommand{head}[1]{textbf{#1}}
begin{document}
begin{tabbing}
begin{tabbing}
Family = verb|textrm{…}| = head{Declaration} = kill
> head{Command} > head{Declaration} > head{Example}\
Family > verb|textrm{…}| > verb|rmfamily|
> rmfamily Example text\
> verb|textsf{…}| > verb|sffamily|
> sffamily Example text\
> verb|texttt{…}| > verb|ttfamily|
> ttfamily Example text
end{tabbing}
begin{tabbing}
Family = verb|textrm{…}| = head{Declaration} = kill
> head{Command} > head{Declaration} > head{Example}\
Family > verb|textrm{…}| > verb|rmfamily|
> rmfamily Example text\
> verb|textsf{…}| > verb|sffamily|
> sffamily Example text\
> verb|texttt{…}| > verb|ttfamily|
> ttfamily Example text
end{tabbing}
After we noticed that our tab stops have been set too narrow, we constructed a new first row containing the tab stops. It consists of words representing the widest entries of each column. To hide this auxiliary row, we used the command kill right at the end of the line; kill at the end of a line causes this line to have no output.
Like in this example, the command verb|code| typesets code “as it is”, without interpreting commands within. Instead of |, any character may be chosen as the delimiter. verb cannot be used in arguments of commands including section and footnote, and not in table heads.
For longer, verbatim text, use the environment with the same name: verbatim.
There are further useful commands:
The mentioned commands already allow a good use of the tabbing environment. Even more commands can be found in the reference manual: http://texblog.net/help/latex/ tabbing.html.
Inside tabbing environments, declarations are local to the current item. A following =, >, \, or kill command would stop the effect.
Tabbing environments cannot be nested.
I remember deciding to pursue my first IT certification, the CompTIA A+. I had signed…
Key takeaways The transformer architecture has proved to be revolutionary in outperforming the classical RNN…
Once we learn how to deploy an Ubuntu server, how to manage users, and how…
Key-takeaways: Clean code isn’t just a nice thing to have or a luxury in software projects; it's a necessity. If we…
While developing a web application, or setting dynamic pages and meta tags we need to deal with…
Software architecture is one of the most discussed topics in the software industry today, and…