Exporting LaTeX as plain text

Sometimes you need your latex as plain text to copy and paste into online forms and the like. Doing it this way will bring all of your refs and what not correctly. I would recomend turning off page numbers, headers, footers, etc before doing this.

You can convert a pdf to plaintext by using pdftotext pdftotext <target>.pdf which generates <target>.txt using the -raw option might be useuful for tables and the like

Compressing PDFs

When you compile with latex, the result will have whatever images you included in it. They may be really big. Ther are ways to use the image scale argument in LaTeX, but that is clunky. A better way is to shrink the PDF after it is compiled. Ghostscript can help:

gs -dPDFSETTINGS=/prepress -dNOPAUSE -dQUIET -dBATCH -dCompatibilityLevel=1.4 -sDEVICE=pdfwrite -sOutputFile=out.pdf in.pdf

You can change -dPDFSETTINGS to /default if you want a huge file (almost the same as what LaTeX uses) or to /printer if you want something a bit smaller. The other options start to get too small

Bringing PDFs to to other image types:

for f in *.pdf; do pdftocairo -png -r '600' -transp "$f" "$f.png"; done