Things I do in LaTeX which may need justifying to co-authors

Quick things:

All one file

Lots of people feel more organized if they have an outer paper.tex which \includes intro.tex, litreview.tex etc. I used to do that too. Now I find that one large file is better. Here's why

  1. You obviously have your document in some version control system. If you move a block of text from one file to another, none of the VCSs know how to deal with that in the presence of conflicts. In LaTeX it's very common to have to move a block of text, because one needs to move figures. Of course you don't do that till the very end, right? Yes, that's exactly when you don't want a mass of conflicts, and yet it's exactly the point when everyone is frantically trying to fix their section.
  2. If you want to globally search and replace it's much easier to do so in a single file. Yes, of course you should have had the notation right before you started. But you didn't.
  3. If you really think compilation is too slow without \includeonly, try texify –quiet first.
  4. Now, of course it's not a good idea to copy/paste large figures into the main file, but one small tweak makes it much easier to find figure labels etc. Put the graphical content into figs/mybigfig.tex, but put caption and label in the main file:
    \begin{figure}
    \input{figs/mybigfig.tex}
    \caption{lots of lovely plots, all lovingly tikzed (pron TIK-zeed)}
    \label{fig:tikz-virtuosity}
    \end{figure}

Inline macro definitions

Lots of people feel more organized if they have all their macro definitions at the top of the file (or in macros.tex). I agree, for generic macros. However, for symbols, I prefer to define them at the point in the text when they are first introduced. This means that you get an error if you try to refer to \params before they're defined. Example:

\section{Methods}
In this section we blather on for a while about what we're going to do, and 
then in paragraph two, we'll actually tell you.  If I accidentally try to talk 
about $\img$ here, I'll get an error.

\def\img{\mathcal{I}}
\def\samp{\mathbf{g}}
\def\nsamp{n}
We consider an image $\img$ as a list of samples $\{\samp_i\}_{i=1}^\nsamp$.

Misc stuff to paste in the top

%!TEX root = ../paper.tex
% -*- compile-command: "texify --pdf -V --quiet main.tex" -*-

% Silence includegraphics
\setkeys{Gin}{quiet=true}

\usepackage{xspace}
\newcommand{\etal}{\emph{et al.}\xspace}

And see http://www-rohan.sdsu.edu/~aty/bibliog/latex/floats.html

% Twocolumn marginpar, e.g. for CVPR/ICCV
\newcommand\authornote[2]{\textcolor{blue}{\hspace{-1pt}\rule{2pt}{2ex}\hspace{-1pt}}%
\marginpar[~\hspace{-12mm}\parbox{16mm}{\tiny \textcolor{blue}{#1:#2}}]%
{~\hspace{-4mm}~\parbox[t]{20mm}{\tiny \textcolor{blue}{#1: #2}}}}
\def\awf#1{\textcolor{red}{\!\scriptsize $^\bullet\!$}%
\marginpar{\hspace{-4mm}\parbox[b]{1cm}%
{\rotatebox{90}{\parbox{5cm}{\textcolor{red}{\scriptsize $\bullet$ #1}}}}}%
}
% Shrink-to-fit parbox, aliging on top of first line
\newcommand{\hangbox}[1]{
\begin{minipage}[t]{\textwidth}% Top-hanging minipage, will align on
			       % bottom of first line
\begin{tabbing} % tabbing so that minipage shrinks to fit
\\[-\baselineskip] % Make first line zero-height
#1 % Include user's text
\end{tabbing}
\end{minipage}
}

Picture with label in circle

\usepackage{tikz}
\def\labelledpic#1#2{
\begin{tikzpicture}
\node (pic) {#1};
\path[fill=white,draw=gray,thick] (pic.south west) +(3ex,3ex) circle (2ex)
   node {#2};
\end{tikzpicture}
}
\labelledpic{\includegraphics[width=0.3\textwidth]{hohum}}{A}

Two pictures with same height, forcing total width

% \awfTwoPicsSameHeight{WIDTH}{PIC1}{PIC2}
% Make two pictures of different aspect ratio sit neatly in a box of width WIDTH
\newlength{\awfpicH}
\def\awfTwoPicsSameHeight#1#2#3{
\setlength{\awfpicH}{0.25\linewidth} % an initial guess...
\def\pair##1{\includegraphics[height=##1]{#2}~\includegraphics[height=##1]{#3}}
\setlength{\awfpicH}{\awfpicH*\ratio{\linewidth}{\widthof{\pair{\awfpicH}}}}
\pair\awfpicH
}
latex.txt · Last modified: 2024/02/01 16:37 by awf
CC Attribution 4.0 International
Driven by DokuWiki Recent changes RSS feed Valid CSS Valid XHTML 1.0