tech log on gentoo, linux, and random stuff

Posts Tagged ‘latex

stripping url output from bibtex

leave a comment »

The bibliographical information as supplied by journals usually includes a URL field, and bibtex styles like \bibliographystyle{apsrev} will export the URL field in the resulting .bbl file, very nagging to some of us. One way to get rid of these URL links is to use a customized .bst file, e.g.,

  1. locate apsrev to find where the apsrev.bst file is.
  2. cd to the directory, and invoke grep -v 'format.url output' apsrev.bst > your/manuscript/directory/apsrev-no-url.bst to create a no-url version of the bst file in your manuscript directory (or any other directory in the search path of bibtex).
  3. now, in your manuscript, replace \bibliographystyle{apsrev} with \bibliographystyle{apsrev-no-url}

Written by zsh

January 4, 2012 at 4:19 pm

Posted in /etc

Tagged with , , ,

latex-beamer presentation on dual display (laptop + projector)

with 3 comments

The latex-beamer class supports a \note{} macro where one can add notes/slide descriptions that can be hidden from the audience.Combined with the \setbeameroption{show notes on secondscreen} option (and the pgfpages package), each page in the resulting pdf file has the presentation slide and the notes slide placed side by side. Then one can set up a dual-display environment—laptop + projector being the scenario I’m interested in—so that the presentation slide will show up on the projector while the notes slide is on the laptop. The restrictions here are

  1. the two displays better have the same resolution

    There is a way around this, described here, where essentially one sets up the projector to just reproduce part of the laptop screen, but I find the resulting image on the projector a bit too fuzzy.

  2. The pdf viewer must be able to span the two displays in its presentation mode. Surprisingly my day-to-day choice of lightweight viewer, evince, doesn’t support this—instead it just spans a single display in its full screen mode. (I’m using xrandr for dual-display setup. more on that later). Luckily acroread behaves in the desired manner (with some caveat. see below)

Here’s the script I use to add a projector to the right of my laptop screen (i.e., right edge of laptop screen identified with left edge of the projector screen):

xrandr --output LVDS1 --mode 1024x768 --primary
# force use 1024x768 mode of the projector
xrandr --output VGA1 --mode 1024x768 --right-of LVDS1 || (xrandr --addmode VGA1 1024x768 && xrandr --output VGA1 --mode 1024x768 --right-of LVDS1)

Three things to note:

  1. The reason why I put the projector on the right is because the window manager I use (awesome) automatically push all windows onto the left-most screen when a second screen is added, and you don’t want all your stuff to go up onto the projector–I’m sure there is a way to overcome this in awesome but I’m just too lazy.
  2. The --primary is also necessary, this tells xrandr to set the laptop screen (LVDS1) as the primary one. Why? Because when going into full screen mode, acroread aligns the top-left corner of your document to the top-left of the primary screen. If your projector ended up becoming the primary screen, your notes will be displayed on the projector instead of your slides (which is pushed outside the visible range).
  3. With the above layout, your beamer document should have notes frames placed on the left hand side, \setbeameroption{show notes on secondscreen=left}

For completeness, here is the script to shut off the projector output:

xrandr --output VGA1 --off
xrandr --output LVDS1 --auto

Written by zsh

March 18, 2011 at 12:51 am

TeX capacity exceeded

leave a comment »

After the discovery of gnuplot’s tikz term, I have been using it for most of the plots I send to my advisor. A very nagging problem though is that when the number of data points is big, pdflatex would complain about “TeX capacity exceeded, sorry [main memory size = xxxx]” and refuse to compile. Today it has just come to a point I can’t stand this any more, so I did some googling and found a solution. Now TeX is a very messy system with fmt, sty, cnf files all over the place, so be sure to backup anything you touch in case something goes wrong.

Here’s a web page from JadeTeX that pointed me in the right direction, http://jadetex.sourceforge.net/#index-div-d18e113. The following solution is based on this.

  1. make changes to texmf.cnf. You may want to use `locate texmf.cnf’ to find where it is. Then in it, change `main_memory’ from 3000000 to say 8000000
  2. now regenerate latex.fmt for plain latex, or pdflatex.fmt for pdflatex. E.g., to recompile pdflatex.fmt:
    1. find where “pdflatex.ini” is
    2. cd to that path, then invoke “pdflatex -ini -progname=pdflatex pdflatex.ini”
      Notice that this is different from what’s in the JadeTeX webpage. You need to invoke “pdflatex” instead of “tex”
    3. now find where the original “pdflatex.fmt” is, back it up, and copy the generated “pdflatex.fmt” to there
  3. to regenerate “latex.fmt”, use “latex -ini -progname=latex latex.ini


In gentoo, the proper way of fixing this once and for all is:

  1. Change the value of the corresponding field in file /etc/texmf/texmf.d/20sizes.cnf. This should persist through all future texliveupgrades.
  2. run texmf-update to regenerate the system-wide texmf.cnf
  3. run fmtutil-sys --all to regenerate the .fmt files


alternatively one can compile with lualatex, which doesn’t seem to have a size limit

Written by zsh

February 23, 2011 at 2:37 pm