paper-draft-tex showcases how you might want to structure the draft of your scientific paper in LaTex. It also provide a useful (basic) function to format Matlab-generated figures to Latex-ready high-quality ones.
It helped me structure my ideas and results to share them effectively with my supervisors before formatting the manuscript according to the journal template.
The source codes in latex-template are edited with TeXstudio, which compiles them to produce main.pdf. The function to format the figures is written in Matlab. This work is under the MIT License and adapts these tips.
.
|-- main.tex
|
|-- src/
| |-- abstract.tex
| |-- appendix/
| | |-- ffsp.tex
| |-- bibliography.bib
| |-- discussion.tex
| |-- introduction.tex
| |-- materials-and-methods.tex
| |-- results.tex
|
|-- fig/
| |-- nice-cat.jpg
| |-- gscatter.eps
| |-- spy.pdf
The idea is to keep this separated for a flexible and efficient management of the drafting process.
If one has a lot of figures, the best strategy is to create an ad-hoc folder in fig
.
For instance, a fig/results
folder for the figures in the Results section.
-
One sentence per line in your source file. For example
Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Interdum velit laoreet id donec ultrices tincidunt.
It is easier to source control and collaborate.
-
Select the correct Capitalization style for the title, subtitle, sections, and subsections with this tool.
-
Keep referenced object and reference number in the same line with the tilde
~
character.Section~\ref{sec:problem-statement} talks about ...
It avoids ugly line breaks. Consider adding what you need in your preamble
\newcommand{\refalg}[1]{Algorithm~\ref{#1}} \newcommand{\refapp}[1]{Appendix~\ref{#1}} \newcommand{\refchap}[1]{Chapter~\ref{#1}} \newcommand{\refeq}[1]{Equation~\ref{#1}} \newcommand{\reffig}[1]{Figure~\ref{#1}} \newcommand{\refsec}[1]{Section~\ref{#1}} \newcommand{\reftab}[1]{Table~\ref{#1}}
Now you can write
\refsec{sec:problem-statement} talks about ...
-
For tables, use booktabs package. Simple, minimalistic tables look nicer. Further details here.
-
Format number with the siunitx package. Use it to round up
\usepackage{siunitx} % ... \sisetup{ round-mode = places, round-precision = 3 }
and to align numbers in tables.
\usepackage{booktabs} \usepackage{siunitx} % ... \begin{table} \centering \begin{tabular}{lS} \toprule Letter & {Number} \\% headers of S columns have to be in {} \midrule A & 1.34092 \\ B & 2.234000 \\ C & 3.73333 \\ \bottomrule \end{tabular} \caption{Numbers alignment with \texttt{siunitx}.} \end{table}
-
Define variables with the fixmath package
Scalars Vectors Matrices Random Varibales $x$
$\mathbold{x}$
$\mathbold{X}$
$X$
-
Add superscripts or subscripts to variables outside of the styling:
Good Bad $\mathbold{x}_i$
$\mathbold{x_i}$
-
Define your custom commands to shortcut math notation and make the source LaTex more readable, especially if you have variables that you use a lot.
\renewcommand{\vec}[1]{\mathbold{#1}} % for vector \newcommand{\mat}[1]{\mathbold{#1}} % and matrices
For drafting purposes, set
\usepackage[backref=page]{hyperref}
It helps to track how many times and where you cite a reference. You can modify how it looks
\renewcommand*{\backref}[1]{}
\renewcommand*{\backrefalt}[4]{{\footnotesize [%
\ifcase #1 Not cited.%
\or Cited on page~#2%
\else Cited on pages~#2%
\fi%
]}}
Write a comment above a particular figure with the command used to generate that figure in the LaTeX file. Very useful.
-
Many simple figures are better than one complex figure.
-
All figures should have the same fonts for labels and axes (define the size at the script level, avoid resizing it in the Tex document).
-
The format in which you save your figures depends on the data you want to represent, the script that generates it, and the Tex compiler you are using (latex or pdflatex).
These are the most popular formats:
There exist many tools to format high-quality figures, like export_fig
or plotly_matlab
. However, if you are interested, I have written a basic version of such tools that achieve similar results. Check the documentation for ffsp
. I have used it for the Matlab-generated figures showcased in this template.