LaTeX Tips and Tricks

A collection of links to documents which I have found helpful in working with the LaTeX document preparation system. An internal link to all documents related to LaTeX can be accessed here.

 
Getting Started

 
CV Creation

 
Journal Submission

 
Collaborative Writing Ideas

Customizing BibTeX

 
Premise:

See attached files for a bibliography style (.bst) file that is compatible with the SSSAJ (Soil Science Society of America Journal) style guidelines.

 
General Notes:

  • when citing named chapters in a book, use the incollection entry type
  • when using makebst get the style as close as you can to the target, then tweak the resulting .bst file

 
Documentation:

http://www.andy-roberts.net/misc/latex/latextutorial3.html

 
A Custom Bib Style:

latex makebst

Latex to ODT conversion tips

 
Conversion of a .tex document to open document format (RTF)

latex2rtf file.tex

 
Conversion of a .tex document to open document format (ODT)

mk4ht oolatex file.tex

 
Some notes:

  1. disable hyperref package to prevent odd bug in citation listings
  2. input document should be latex-safe, i.e. eps figures
  3. need a working java installation
  4. commands like \onehalfspacing or begin{singlespace}...end{singlespace} may not work (setspace package)

 
Conversion of PDF, EPS, or Postscript figures to EMF (enhanced metafile format) for windows apps.

Note that these instructions are for unix-like systems. EMF support can be added to pstoedit via libEMF. The libEMF library contains several windows-specific coding practices, along with some sloppy use of include files. Instructions for compiling with a modern version of GCC (4.x) can be found here.

  1. Some related pages
    • http://www.physik.tu-cottbus.de/~george/unix/emf4unix.html
    • http://boshoff.za.net/linux/archives/2003_08.html
  2. download, hack, and compile the libEMF code (details)
  3. download, configure, and install pstoedit, note that you may have to manually define where the libEMF header and lib files are:
    ./configure --with-libemf-include=/usr/local/include/libEMF/ \
    --with-libemf-lib=/usr/local/lib/
  4. run ldconfig as root to refresh the library cache
  5. [Finally] Convert a PDF file into an OpenOffice-compatible EMF file (well sort of...)
    pstoedit -pta -f emf:"-OO -p -drawbb" file.pdf file.emf
  6. It seems like figures are clipped to smaller-than-expected bounding boxes unless the special flag -drawbb is used. One side-effect of this however is a box drawn around your figure. Also, the -pta flag is needed to ensure quality text placement. Even though the resulting EMF files may look odd on a Linux machine, they appear to work as expected in Windows.
  7. 

Making better looking tables with \ctable

 
Premise:
The standard Latex table environment can be difficult to extend, especially when one wants to use modern constructs such as table foot notes, etc. The ctable package is a convenient approach to solving this problem. A complete worked example of a table typset using the \ctable command is presented below. Note that \ctable is a command, and therefore does not allow blank newline characters. One way to maintain readability is to trick Latex by adding a comment character to all blank lines. Link to PDF manual for ctable.

Example of table produced with ctableExample of table produced with ctable

 
Code used to produce the example above. This example was produced with TexLive.

%
% start the table: note that we cannot have extra newline characters in the ctable defs
\ctable[
	cap     = {logistic regression parameters},
	% 
	caption = {Logistic regression model (M3) parameters. Coefficients, standard error, z-values, and p-values are included for each term used in the model. A separate slope and intercept term was fit to each geologic class.},
	% 
	label   = {aspect_effect:table:glm_model_properties},
	%
	%
]{lccc}{
	%
	\tnote[$\ast$]{Marginal p-values are used to determine whether each term is significantly different than 0.}
	%
}{ \FL
% 
Model Term & Value & Std. Error & Marginal p-values\tmark[$\ast$]      \ML
% 
Intercept & & &  \\  \cmidrule(r){1-1} 
% 
\;\;  andesite         &          1.146e+01   &   6.920e+00     &   0.09781  \\
\;\;  clastic\_volcanic   &        3.471e+00   &   2.234e+00    &       0.12024  \\
\;\;  coarse\_sedimentary  &       4.446e+00   &   2.390e+00    &    0.06285  \\
\;\;  felsic\_intrusive     &      5.384e+00   &   2.714e+00    &      0.04725  \\
\;\;  fine\_sedimentary   &        8.527e+00   &   4.013e+00      &   0.03361  \\
\;\;  rhyolite       &            1.075e+01   &   4.071e+00    &      0.00828 \\
\;\;  tuff              &         1.657e+01   &   9.116e+03    &      0.99855   \\
% 
% 
\\
Slope & & & \\   \cmidrule(r){1-1} 
% 
\;\;  andesite       &      -1.356e-03   &   8.448e-04     &  0.10858  \\ 
\;\;  clastic\_volcanic    &  -3.588e-04   &   2.851e-04     &   0.20825  \\
\;\;  coarse\_sedimentary  &  -8.165e-04   &   3.336e-04   &   0.01438  \\
\;\;  felsic\_intrusive    &   -6.352e-04    &  3.503e-04    &     0.06977  \\
\;\;  fine\_sedimentary    &   -1.122e-03   &   5.139e-04   &    0.02897  \\
\;\;  rhyolite       &       -1.361e-03  &    4.873e-04   &   0.00522  \\
\;\;  tuff         &         6.155e-14   &   1.200e+00   &   1.00000
% 
%  
\LL}