Journal home page
General information
Submit an item
Download style files
Copyright
Contact us
logo for The PracTeX Journal TUG logo

Ask Nelly:
      How do I create math mode columns in tabular environments?
      How do I find the files required to compile my document?

The Editors

Abstract


Ask Nelly is a question and answer column. Nelly is the quiet person who sits at the back corner desk, who knows a lot, and when asked any question is always ready with a patient answer. If Nelly doesn't know the answer, Nelly will know an expert who has the answer. Feel free to Ask Nelly about any aspect of LaTeX, TeX, Context, etc.


tpjlogo

Q: Dear Nelly: When I create tables with columns for which each and every cell contains mathematical content, I keep on switching into and out of Math mode all the time. Surely there is a better way to do this?

A: There is indeed! Frank Mittelbach and David Carlisle, names probably not unfamiliar to you, have solved this problem for you with their wonderful array package. This package, among many other things, redefines the tabular environment in such a way that it allows you to already declare mathematical mode when defining your table, so instead of — for example — using

	\begin{tabular}{lll}
	
when you want all three columns to just contain material to be typeset in math mode anyway, you could use
	\begin{tabular}{>{\(}l<{\)}>{\(}l<{\)}>{\(}l<{\)}}
	
which creates a table with three left aligned columns, all three of which are to contain mathematical content.

Should you want to create many such tables in your document, array even allows you to define new column types to make your life easier still. To define the mathematical equivalents of the three standard column types, just use

	\newcolumntype{L}{>{\(}l<{\)}}
	\newcolumntype{C}{>{\(}c<{\)}}
	\newcolumntype{R}{>{\(}r<{\)}}
	
and then whenever you need to create a three column table with three left-aligned columns containing mathematical contents all you need to do is
	\begin{tabular}{LLL}
	
Although remember to use \multicolumn to change a cell back to regular type if you need non-mathematical information in a cell, as is often the case in, for example, column headings. An example, assuming the new column types having been defined as explained above:
	\begin{tabular}{LLL}
	\hline
	\multicolumn{1}{l}{Function}&\multicolumn{1}{l}{Derivative}&\multicolumn{1}{l}{Primitive}\\
	\hline
	ax^n & nax^{n-1} & \frac{1}{n+1}ax^{n+1} + C\\
	\sin(x) & \cos(x) & -\cos(x) + C\\
	\cos(x) & -\sin(x) & \sin(x) + C\\
	\hline
	\end{tabular}
	


The above question was answered by Yuri Robbers, a member of the editorial board of this journal. He can be reached at

tpjlogo

Q: Dear Nelly: When I tried to co-author a paper, I ran into trouble because my colleague did not have some of the files needed to properly compile the document. I am aware of the \listfiles directive, which can be added to the preamble in order to get a list of files included by LaTeX. In some cases, however, when trying to locate these files on my system I find multiple versions (Yes, I know, I should take better care of my system, but there you have it!). Is there a way to get the file list with the full path to each file?

A: The problem here is that the TeX engine is not actually aware of path names. Luckily, there is a way around this. If you use the option -recorder with tex, latex, pdflatex etc. you will get a file with extension .fls that contains every file opened for input as well as output, including their pathnames.

As an example I did a LaTeX run on a tiny example file, as follows:

	pdflatex -recorder centaurtestje
	
And the resulting file centaurtestje.fls has the following contents:
	PWD /home/yuri/texmf/knoeien
	INPUT /home/yuri/.texlive2007/texmf-var/web2c/pdftex/pdflatex.fmt
	INPUT centaurtestje.tex
	OUTPUT centaurtestje.log
	INPUT /usr/local/texlive/2007/texmf-dist/tex/latex/base/article.cls
	INPUT /usr/local/texlive/2007/texmf-dist/tex/latex/base/article.cls
	INPUT /usr/local/texlive/2007/texmf-dist/tex/latex/base/size10.clo
	INPUT /usr/local/texlive/2007/texmf-dist/tex/latex/base/size10.clo
	INPUT centaurtestje.aux
	INPUT centaurtestje.aux
	OUTPUT centaurtestje.aux
	OUTPUT centaurtestje.pdf
	INPUT /usr/local/texlive/2007/texmf-var/fonts/map/pdftex/updmap/pdftex.map
	INPUT centaurtestje.aux
	
This is probably sufficient information for you. You could, however, go one better still, if you so desire. Scott Pakin created the bundledoc package, available from CTAN. It can find all files needed to compile a LaTeX document and automatically bundle them in an archive file.

As a bonus, bundledoc includes the program arlatex, written in perl, which can create a single .tex file which contains all the other files needed to compile your document. Running the resulting .tex-file through latex recreates all the original files again, bypassing the need for external archievers such as tar, zip, etc.

bundledoc can easily be configured to use arlatex as its archiver.


The above question was answered by Yuri Robbers, a member of the editorial board of this journal. He can be reached at

tpjlogo


Page generated June 9, 2010 ;

TUG home page; webmaster; facebook; twitter; mastodon;   (via DuckDuckGo)