# What’s the proper bibtex type for ArXiV papers?

I like to use @techreport, like

 @techreport{ShakeriBS:16ks_dict, author = {Z. Shakeri and W.U. Bajwa and A.D. Sarwate}, title = {Minimax Lower Bounds on Dictionary Learning for Tensor Data}, number = {arXiv:1608.02792 [cs.IT]}, month = {August}, year = {2016}, institution = {ArXiV}, url = {http://arxiv.org/abs/1608.02792}, } 

but the handy-dandy ArXiv to BibTeX uses @misc (which makes it less handy-dandy, TBH):

 @misc{1608.02792, Author = {Zahra Shakeri and Waheed U. Bajwa and Anand D. Sarwate}, Title = {Minimax Lower Bounds on Dictionary Learning for Tensor Data}, Year = {2016}, Eprint = {arXiv:1608.02792}, } 

I’d ask this on the TeX Stack Exchange but it seems more of a matter of taste.

# PSA on IEEEtran.cls

Apparently there’s a PSA out about using the latest version of IEEEtran.cls. Stefan Moser is a big proponent of IEEEeqnarray which he says is even better than my beloved align environment. He also hates on the shorthand  for resulting in “poorly readable” source code, but I guess I disagree on that point. He even says it’s better than multline! I guess I’ll have to revise my LaTeX practices… but only when I write IEEE papers.

# Some LaTeX hacks for writing proposals

I just submitted my CAREER proposal on Monday, and now that the endless revision process is over, I wanted to write a post about what I learned about proposal writing. But that seems like hubris, since I have no idea if the thing will get funded, so what do I know? Besides, everything I learned was from the valuable feedback I got from those who very kindly read my previous drafts. So instead of writing about How To Sell Your Idea, I figured I would write about some cute LaTeX hacks that I came across, most of them via the very useful TeX-LaTeX Stack Exchange.

If anyone else has some useful hacks, feel free to leave them in the comments!

Saving Space

One of the big problems in NSF proposal writing is that there’s a hard limit on the number of pages (not the number of words), so if you’re at the edge, there’s a lot of “oops, two lines over” hacking to be done towards the end.

• \usepackage{times} \usepackage{mathptmx}: The typeface for your proposal makes a big difference in space. Computer Modern is a bit easier to read since there’s more whitespace, but Times shaved a whole page off of my proposal. The NSF Grant Proposal Guidelines has the list of approved formatting. It seems standard for NIH proposals to use 11pt Arial but that makes me want to gouge my eyes out. Know thy reviewers, is what I would say: keep in mind what’s standard for the solicitation and don’t make the proposal so dense as to be unreadable. NB: Apparently the times package is deprecated (see comments).
• \usepackage{titlesec}. This package lets you control the spacing around your titles and subtitles like this:

 \titlespacing\section{0pt}{10pt plus 2pt minus 2pt}{2pt plus 2pt minus 2pt} \titlespacing\subsection{0pt}{8pt plus 2pt minus 2pt}{2pt plus 2pt minus 2pt} 

See this post for more details, but basically it’s \titlespacing{command}{left spacing}{before spacing}{after spacing}. This is handy because there’s a lot of empty space around titles/subtitles and it’s an easy way to trim a few lines while making sure things don’t get too cramped/ugly.

• \usepackage{enumitem}: This package lets you control the spacing around your enumerate lists. The package has a lot of options but one that may be handy is \setlist{nosep} which removes the space around the list items. This actually makes things a little ugly, I think, but bulleted lists are helpful to the reviewer and they also take a little more space, so this lets you control the tradeoff. Another thing that is handy to control is the left margin: \setlist[itemize,1]{leftmargin=20pt}.
• \usepackage{savetrees}: Prasad says it’s great, but I didn’t really use it. YMMV.

Customizations

• Sometimes it’s handy to have a new theorem environment for Specific Aims or Open Problems or what-have-you. The problem is (as usual) that the theorem environment by itself puts in extra space and isn’t particularly customizable. So one option is to define a new theorem style:

 \newtheoremstyle{mystyle}% name {5pt}%Space above {5pt}%Space below {\itshape}% Body font {5pt}%Indent amount {\bfseries}% Theorem head font {:}%Punctuation after theorem head {4pt}%Space after theorem head 2 {}%Theorem head spec (can be left empty, meaning ‘normal’)

 

\theoremstyle{mystyle} \newtheorem{specaim}{Specific Aim} 

• Another handy hack is to make a different citation command to use for your own work that will then appear in a different color than normal citations if you use \usepackage[colorlinks]{hyperref}. I learned how to do this by asking a question on the stack exchange.


• The hyperref package also creates internal links to equations and Figures (if you label them) and so on, but the link is usually just the number of the label, so you have to click on “1” instead of “Figure 1” being the link. One way to improve this is to make a custom reference command:

 \newcommand{\fref}[2]{\hyperref[#2]{#1 \ref*{#2}}} 

So now you can write \fref{Figure}{fig:myfig} to get “Figure 1” to be clickable.

• You can also customize the colors for hyperlinks:

 \hypersetup{ colorlinks, citecolor=blue, linkcolor=magenta, urlcolor=MidnightBlue} 

• Depending on your SRO, they may ask you to deactivate URLs in the references section. I had to ask to figure this out, but basically putting \let\url\nolinkurl before the bibliography seemed to work…

# mergetex script updated

I ported the mergetex script from perl to python and posted it on github, for those who are interested. It scans recursively though a large LaTeX project and generates a single .tex file suitable for uploading to ArXiV (with comments stripped out). I probably should have have branched from Manu’s though, oops. Ah well. There are lots of versions of this thing out there, so no claims to elegance here.

A related question (which I gave up on after a short attack) was how to generate a regular expression that matches the first part of a line of LaTeX before a comment. The trick is that \% is escaped, so you want

There is a 95\% chance that I am bad at regexps % DUH\n

to return

There is a 95\% chance that I am bad at regexps %

and

There is a 95\% chance that I am bad at regexps % DUH more like 99\%\n

to return

There is a 95\% chance that I am bad at regexps %

but

There is a 95\% chance that I am bad %at regexps % DUH more like 99\%\n

to return

There is a 95\% chance that I am bad%

Some sort of negative lookbehind is needed but I got confused and decided to do something less efficient.

# GmailTeX

Avleen Bijral, one of the students here at TTIC, sent me a link to a pretty cool browser plugin for GMail called GMail TeX. Basically it lets you send LaTeX formatted emails via gmail. This can be quite a time saver for the reader (but maybe not the writer) if you’re remotely collaborating on some project (which I so often am these days, it seems). It’s supported on a wide variety of browsers and seems worth checking out!

# Write Latex

Via Erin comes a link to a collaborative web-based LaTeX tool called WriteLaTeX. I feel like someone else told me about this before (it’s been around since the end of September 2011), but I still haven’t tried using it. Has anyone else had much luck actually writing papers with it?

New(ish) policies at the NSF — read up if you are planning on writing some grants! h/t to Helena, who sent this in aaaaages ago.

I’m not sure I agree that these are the 10 must-listen, but it’s something at least.

This article on Jonah Lehrer is quite interesting. I think there are some things to be learned here for academic writers as well…

I forgot to add a link to Suhas Mathur has a blog, sorry!

bibimbap is a tool to import BibTeX entries from various sources. It runs in the console and is designed to be simple and fast. bibimbap is simply the easiest way to manage your BibTeX bibliographies. Be advised that it still won’t read the papers for you, though.” — looks like it could be awesome. h/t to Manu.

/

# Allerton margin woes

Apparently the specifications for the Allerton camera-ready copy insist on different page margins for the first page: 1 inch on top and 0.75 on the sides and bottom, whereas it’s 0.75 all around for the other pages. I submitted the paper and was told I had margin errors so I downloaded the draft copy and lo and behold I got an annotated PDF with gray boxes and arrows showing that every page had margin violations. How could that be, I thought?

It seemed that this is different than the default \documentclass[conference,letterpaper]{IEEEtran} options. After hacking around a bit I came across this hack but when I used \usepackage[showframe,paper=letterpaper,margin=0.75in]{geometry} the line-frames around each page showed that all of my text was inside the margins.

Either PaperCept is altering my PDF or it is not capable of calculating margins correctly, or the geometry package is not working. Given the problems I’ve had with PaperCept in the past, I’m guessing that it’s not the latter. My only hack was to use the geometry package to set the margins of all pages to 1 inch.

Did anyone else have these weird margin issues?

Update: Upon further checking, it appears that the margins enforced by PaperCept are not the margins for \documentclass[conference,letterpaper]{IEEEtran} but instead most likely for IEEEconf, which has (I believe) been deprecated. Yikes!

Update 2: This is, in fact, my fault, since the documentation says to use IEEEconf.cls. I am still confused as to why that’s the standard for Allerton. Also, this is the 2002 version of IEEEconf.cls, and there are even newer versions than that. Sigh.

# IEEE PDF “Express”

So IEEE wants PDFs that appear on IEEExplore to have two properties:

• all fonts are embedded
• the compatibility level is 1.4

Seems simple, right? Except that their instructions for PDF Express are for those who use Adobe Distiller, which I don’t have. You’d think there would be a simple workaround, but no…

This post suggests using ps2pdf command line options, which works if all of your figures are in EPS, but not if you have PDF or JPG figures. Daniel Lemire suggests converting the PDF to PS and then back to PDF.

That didn’t really work for me — I alternately got errors saying they wanted Adobe version 5 or higher (corresponding to compatibility level 1.4) or that fonts were not embedded. I blame Mac OS. On the 10th attempt at uploading, I finally got it to work. Here’s what I did:

1. Generate the PDF however you like (command line or TeXShop)
2. Open the PDF in Preview, duplicate, and save a copy. This will embed the fonts but make the PDF version 1.3 or something. Say the file is called copy.pdf.
3. In a terminal, run pdf2ps copy.pdf to generate copy.ps. This will create a PS file with the fonts embedded.
4. Run pdf2ps14 -dEmbedAllFonts=true copy.ps to generate a new version of copy.pdf that is both 1.4 and has fonts.

This is dumb. I wasted about an hour on this idiocy and still don’t understand why it’s such a pain. It seems that on a Mac, dvips does not embed fonts properly by default, and pdflatex also cuts corners. Furthermore, it doesn’t seem like one can pass command line options (and make them default in TexShop) to automate this process.

I am sure there are better ways of doing this, but for the time being, this at least works.