Skip to content

Basic Formatting

Wout Dillen edited this page Jun 15, 2021 · 13 revisions

After adding compatible .tex files to your LaTeX project, referencing them in your main.tex file, and recompiling your PDF document, you will likely want to fix some formatting issues. The following methods can be used to make the contribution conform to the layout of the Variants journal.

Fix all unrecognized (sub)sections

If the author didn't use Heading templates, (sub)section titles will just be treated as formatting. They still need to be manually changed into \section{}, \subsection{}, etc. where appropriate. Don't forget the asterix if sections have no section numbers (e.g. \section*{TITLE}.

Change m-dashes

All dashes should be ---.

Find: --

Replace: ---

NOTE: Make sure to include the whitespace at the end of both Find and Replace.

Footnotes inside figures or tables

Since figures and tables are special environments inside your document environment, they are notoriously difficult to add footnotes to. We found that the most elegant solution to this issue, is to separate the footnote text from the footnote marker (placing the latter outside of the table or figure environment), and to temporarily switch to symbols as footnote markers -- to make sure you don't interfere with the numbering of all the regular footnotes. In practice, applied to a table, this solution looks as follows:

\renewcommand*{\thefootnote}{\fnsymbol{footnote}}

\begin{table}[h!]
\begin{tabular}{c|c|c}

1a & 1b & 1c\footnotemark[1] \\
\midrule
2a & 2b & 2c\footnotemark[2] \\
  
\end{tabular}
\end{table}

\footnotetext[1]{a footnote to cell 1c}
\footnotetext[2]{a footnote to cell 2c}
\renewcommand*{\thefootnote}{\arabic{footnote}} 

Here, the first \renewcommand{} switches the footnote mark to symbols, the second one reverts it back to numbers.

Change the font of URLs (optional)

Pandoc will automatically transform all URLs into \url{} commands. In the compiled PDF, this will result in a clickable link in a monospaced font. If this font change does not bother you, we recommend you to keep it as such, because it is a quick and easy solution, that also works well with the LaTeX layouting (long links will not overflow their text boxes, but break automatically onto a new line).

If you need URLs to be visualised in the same font as the rest of the text, however, an alternative command to encode them would be \href{}{}. This command has two arguments: first to provide the link, then to provide the text that should be linked (i.e.: \href{link}{text}). Because you will want to print the URL itself, this effectively means the URL will be recorded twice, once in {link}, and once in {text}.

You can replace all occurrences of the url{} command into the \href{}{} command by using Regular Expressions. Be sure to activate RegEx in the Find/replace prompt (by clicking on the .* button), and fill out the following information in the Find and Replace fields:

Find: \s?\\url{([\w:/.\-\?]*)}\s?

Replace: href{$1}{$1}

NOTE:

This method will require some post-editing:

  1. Textboxes that contain links that are too long for them will overflow, leaving the URL to continue in (and beyond) the right margin of the page. You can fix this by adding a space in {text} where you want the link to break and continue on the next line.
  2. If the URL has any special characters in it (typically: underscores), they need to be escaped in the {text} field. To solve this issue, go to the places where Overleaf throws an error, and place an escape character \ before all special characters in this part of the link.
  3. Take into account that if you use BibTex, URLs will likely still be printed in monospace in your bibliography. To keep the ways URLs are treated uniform, we recommend sticking to \url{}.

Lessons Learned

  1. Some symbols (incl. \smile and \cup are considered as mathematical symbols, and should be placed on a line that is surrounded by $-signs -- or LaTeX will throw an error. For an example, see Subacius in Variants 15.