Tuesday, November 8, 2022

LaTeX to Word

Often I have a document in LaTeX, and somebody else needs an editable copy in Word. Here is a list of hacks I have learnt to use:

1. If the document is relatively free of math and figures then the simplest course is often to compile a PDF, and "import" the PDF into MS Word. This works out remarkably well in many cases.

2. The same thing above applies to figures. You can now directly drop PDF images into a Word doc.

3. If you have lots of equations, then it is worthwhile to use pandoc

pandoc mydoc.tex -o mydoc.docx

More sophisticated options to copy cross-references, and bibliography exist. See this as well.

4. Many journals accept PDF figures. If they need TIFF, then you can use Adobe Acrobat online to do this conversion. In my experience, this produces smaller files compared to other automatic converters including ImageMagick.

Wednesday, August 17, 2022

Recursively Clean LaTeX Debris in all Sub-Folders

 Often, I have a big folder like Lectures/ which may have sub-folders based on topics, and each topic might have additional folders. To clean auxillary LaTeX files in one fell swoop use,

find ./ \( -iname "*.bbl" -o -iname "*.aux" -o -iname "*.log" -o -iname "*.blg" -o -iname "*.nav" -o -iname "*.snm" -o -iname "*.toc" -o -iname "*.vrb" -o -iname "*.out" -o -iname "*.synctex.gz" -o -iname _minted*" \) -delete


Monday, July 18, 2022

RegEx Help

This ML based regex generator is quite handy! 

https://www.autoregex.xyz/home

Wednesday, June 22, 2022

Lectures on Graphical Models

Christopher Bishop has an excellent set (1, 2, and 3) of introductory lectures on "Probabilistic Graphical Models". They are well-motivated and cover topics that include:

  • directed and undirected graphs
  • conditional independence
  • factor graphs
  • inference using factor graphs and sum/product rules

Tuesday, March 22, 2022

QuickTip: Extracting pages from PDF on Linux

On a Mac OSX system, the default app Preview allows you to cut and paste pages from a PDF.

On Linux you can use PDFChain to manipulate PDFs. If you simply want to extract a certain range, then qpdf is quite handy.

A CLI solution is to use ghostscript as described here:

gs -sDEVICE=pdfwrite -dNOPAUSE -dBATCH -dSAFER \

       -dFirstPage=1 -dLastPage=15 -sOutputFile=outfile.pdf inpfile.pdf

You can make the interface friendlier by saving a function in your bashrc as described in the article.