jemnotesversion 2 / featuring tex or see all/search

Feb 25
From here: in latex, you can type \verb|{| and get a real brace in a typewriter font. But if you type {\tt \{ }, you get a sans-serif replacement. In code:
\verb|{|    % nice, real brace.
{\tt \{}    % hideously replaced by sans-serif glyph.
two ways to fix this:
\usepackage[T1]{fontenc}
% or
{\tt {\char '173} }
Feb 25
  • Include the lmodern package for “enhanced versions of the Computer Modern fonts”, including “enhanced metrics and glyph coverage”. The package does seem to improve kerning, and also improves performance when you
  • Include upquote (or textcomp, not sure of the differences), and you get a \textquotesingle. That is good for writing computer code in latex.
Feb 24
Finally, a decent way of controlling preview on the mac via the apple remote. iRed Lite works well, and finally makes it possible to use the remote for texed presentations.
Jan 14
Yep, it’s totally trivial, but I always forget how to create a new command in latex that has arguments. Here it is once and for all.
\newcommand{\err}[1]{\textcolor{red}{#1}}
Jul 29
When typesetting mathematics with LaTeX, note that \mid is a vertical line with spacing as befits a binary relation, and \vert is a vertical line as an ordinary symbol. Compare: $p(x mid y)$ (with \mid); $p(x vert y)$ (with \vert).
Aug 14
Disable highlighting of spurious _ and ^ symbols in LaTeX files as errors (say, when a macro is used to start equation environments).
autocmd Filetype tex syntax clear texOnlyMath
Aug 5
I made some aliases for use when writing LaTeX documents. Add these (perhaps unwieldly) lines to your .bashrc:
# Next command on a single line.
alias lr='latex -file-line-error-style -interaction=nonstopmode $LR.tex > 
  /tmp/latexoutput || cat /tmp/latexoutput ; 
  grep -e "\(LaTeX Warning\)\|\(Overfull\)\|\(Underfull\)" /tmp/latexoutput | 
  grep -v "There were undefined references";
  killall -SIGUSR1 xdvi.bin 2> /dev/null'

alias xdj='xdvi -paper us -expert -keep $LR.dvi 2>/dev/null >/dev/null&'
Note: depending on your system, you made need to replace xdvi.bin with xdvi-xaw3d.bin.
Then, when you are preparing a document, you can do this:
>> LR=myfilename # set filename. The suffix .tex is added automatically.
>> lr            # compiles your latex document.
>> xdj           # displays your latex document.
This sounds pretty ordinary, but these aliases take advantage of these things:
  • lr will only show the output if there was a problem. This avoids polluting your screen.
  • lr will never stop with an error while running latex and leave you punching keys in the hopes of getting back to the command line.
  • latex will tell you the line number of any errors.
  • lr will automatically kick xdvi after compiling the document to show your changes. No need to click on xdvi or wait for it to notice the file changed. I really like the way xdvi permits such updates without flickering.