Report Body Style
We explain how the appearance of material in the body of Lunar Metrology Institute reports is controlled in LaTeX.
LaTeX file for report body
Here is a LaTeX file with commands that specify appearance and some content in the report. The source file is available on github.
The appearance can be specified in the preamble of a LaTeX file (before \begin{document}
) by importing packages and declaring commands.
Appearance is also influenced by the LaTeX ‘class’ file (article
), which is imported by \documentclass
.
The report content itself goes in between \begin{document}
and \end{document}
.
A title page is not produced. Some of the configuration commands were already discussed in relation to the layout of the title page. We explain other details below.
Page style definitions in the preamble
Conventional language and maths options
A certain style of typesetting (here UK English) can be selected by importing the following packages
\usepackage[UKenglish]{babel} % British English conventions
\usepackage[UKenglish,cleanlook]{isodate} % Date format: day month year
We also prefer to use standardised American Mathematical Society maths features, have upright Greek letters available, and SI units, all of which is provided by these packages:1
\usepackage{upgreek}
\usepackage{amsmath}
\usepackage{siunitx}
Figure and table captions
LaTeX has ‘floating’ environments for figures and tables that automatically place these objects to balance the layout of a document. We do not wish to use these features.
We must define a special environment, called \LMICaption
, to add captions, and refer to figures and tables from within the document body.
The syntax is \LMICaption{<type>}{<label>}{<caption-body>}
, where type
is either ‘figure’ or ‘table’; label
is our choice of label that refers to the object; and caption-body
is the text to appear in the caption.
\RequirePackage{capt-of}
\newcommand{\LMICaption}[3]{
\begin{minipage}{.8\textwidth}
\captionof{#1}{\small #3}
\label{#2}
\end{minipage}
\vspace{.5\baselineskip}
}
Control over paragraphs and line spacing
LaTeX indents the first line of new paragraphs by default. This can be avoided by importing the parskip
package. Line spacing can be controlled by setspace
:
\usepackage{parskip}
\usepackage{setspace}
Hyperlinks
The hyperref
package provides support for a wide variety of referencing options in documents. Here, we configure the appearance of links to URLs, pages within the document, and bibliographic reference links.
\usepackage{hyperref}
\hypersetup{
colorlinks=true, % links are coloured
urlcolor=blue, % URLs, etc
linkcolor=black, % Pages, etc
citecolor=blue
}
Header and footer contents
We standardise running header and footer contents using the fancyhdr
package.
Report details appear at the top left corner of the page, the institute name in the centre, and page number on the right.
The institute name is placed one line above the left and right details (achieved by the newline command, \\
, that follows \small\textbf{\LMI}
).
The footer centres a standard disclaimer about use of the report, which defined in the macro \RestrictionsLMI}
.
\usepackage{fancyhdr}
\fancypagestyle{fancy}{%
\renewcommand{\headrulewidth}{0pt} % Suppress a line ruled by fancyhdr
\fancyhf{}
\fancyhead[L]{\small\textnormal{\ReportReference}}
\fancyhead[C]{\small\textbf{\LMI}\\}
\fancyhead[R]{\small\textnormal{\thispageof}}
\fancyfoot[C]{\small\textit{\RestrictionsLMI}}
}
% Pre-defined strings
\newcommand{\LMI}{Lunar Metrology Institute}
\newcommand{\RestrictionsLMI}{%
This report may not be reproduced,
except in full, without the written consent of the\\
Chief Metrologist, Lunar Metrology Institute}
\newcommand{\referenceGUM}{
For information about uncertainty terminology, see:
BIPM, IEC, IFCC, ISO, IUPAC, IUPAP and OIML,
\textit{``Evaluation of measurement data---Guide to the expression of uncertainty in measurement''},
BIPM Joint Committee for Guides in Metrology, Paris, S\`evres, edition 1, JCGM~100:2008, 2008.
A PDF version is available on-line:
\begin{center}
\href{%
https://www.bipm.org/documents/20126/2071204/JCGM_100_2008_E.pdf
}{%
https://www.bipm.org/documents/20126/2071204/JCGM\_100\_2008\_E.pdf
}
\end{center}
}
Section headings and fonts
The appearance of section headings can be controlled by the titlesec
package.
We wish to use particular fonts in these headings too.
Macros that define distinct fonts may use the LaTeX command usefont
.
The syntax for this command is \usefont{encoding}{family}{series}{shape}
.
We are using the ‘T1’ encoding and the Helvetica family (‘phy’).
The series option chooses the font weight (e.g., ‘m’–medium, or ‘bc’–bold condensed).
The shape option specifies the style (e.g., ‘n’–normal, or ‘sl’–slanted).
\newcommand{\lmiboldarialnarrow}{\usefont{T1}{phv}{bc}{n}}
\newcommand{\lmiarial}{\usefont{T1}{phv}{m}{n}}
\newcommand{\lmiboldarialsnarrowlanted}{\usefont{T1}{phv}{bc}{sl}}
\usepackage{titlesec}
\titleformat{\section}
{\lmiboldarialnarrow\Large}{}{0pt}{}
\titlespacing*{\section}
{0pt}{\baselineskip}{0.5\baselineskip}
\titleformat{\subsection}
{\lmiboldarialnarrow\large}{}{0.5em}{}
\titlespacing*{\subsection}
{0pt}{\baselineskip}{0pt}
\titleformat{\subsubsection}
{\lmiboldarialsnarrowlanted\normalsize}{}{0.5em}{}
\titlespacing*{\subsubsection}
{0pt}{\baselineskip}{0pt}
The syntax for the \titleformat
command is \titleformat{<command>}[<shape>]{<format>}{<label>}{<sep>}{<before-code>}[<after-code>]
.
We accept the default value for <shape>
, which displays the title and starts text on a new line.
We combine a font selection and a font size in the <format>
option (e.g., \lmiboldarialnarrow\Large
).
We leave the <label>
option blank to avoid generation of section numbers.
Option <sep>
is a horizontal separation between the end of the section number (even if none has been produced) and the beginning of the name of the section.
Option <before-code>
is used to insert LaTeX commands before the section title is generated (such as vertical space).
The titlespacing
command allows the spacing around section titles to be adjusted.
The syntax of the \titlespacing
command is \titlespacing{command}{left}{before-sep}{after-sep}[right-sep]
.
We use it to insert one blank line before new sections.
Attachments
Files may be embedded in the document as attachments.
The package embedfile
enables this feature.
\usepackage{embedfile}
\embedfilesetup{
filesystem=URL,
afrelationship={/Data},
stringmethod=escape
}
Document metadata
We capture certain document details in our macros and use the hyperref
package to include this metadata in the document.
\ReportNumber{12345}
\ReportTitle{A report on the calibration of an type-N male open}
\date{17 May 2035}
%% XMP Metadata
\hypersetup{
pdftitle={\ReportTitle},
pdfauthor={\LMI},
pdfnumpages={\pageref*{LastPage}}
}
Report body contents
Header, footer, and left alignment of text
The first lines after \begin{document}
set the page style to ‘fancy’, in which a header and footer have been defined.
The \raggedright
command tells LaTeX not to justify the lines of text, which gives a ragged appearance on the right hand side of the text.
The report title is printed, below 4 lines of vertical space, in LaTeX’s \LARGE
sized print.
\begin{document}
\pagestyle{fancy}
\raggedright % Does not adjust the right margin
\vspace*{4\baselineskip}
\textbf{\LARGE\ReportTitle}
Special content markup
There are a few examples of content mark-up in the body of the report.
\textsuperscript
places text in a superscript position- The
\SI
command can be used to format units and numbers correctly - The command
\clearpage
forces a page break - Inline mathematical content is enclosed in a pair of
$
\ref{<label>}
returns the number allocated to whatever object was labelled- Content can be centred horizontally on the page between
\begin{center}
and\end{center}
Tables
The structure of tables in LaTeX is rather intricate. There are many features available. However, tables are usually designed according to specific needs. So, we have just included one table, as an example, in this report.
The body of the table is created by the tabular
environment.
The syntax of the environment opening statement is \begin{tabular}{cols}
, where cols
is a sequence of characters that define the alignment of content in the table columns.
There are five columns each of type S
, which will align numbers on the decimal point
\begin{tabular}{SSSSS}
The \multicolumn
command allows content to span several adjacent columns.
The command syntax is \multicolumn{n}{col}{text}
, where n
is the number of columns that will be joined, cols
defines the alignment of content in the column, and text
is the content.
The &
character acts as a separator between columns.
So, a table with a three-line header followed by a horizontal line is created by
\multicolumn{1}{c}{ frequency } &
\multicolumn{2}{c}{ magnitude } &
\multicolumn{2}{c}{ phase }
\\
% 2nd line
\multicolumn{1}{c}{ (/\si{\mega\hertz}) } &
\multicolumn{2}{c}{ } &
\multicolumn{2}{c}{ (/\si{\degree}) }
\\
% 3rd line
& $\rho$ & ${U(\rho)}$ & $\phi$ & ${U(\phi)}$
\\ \hline % Underline the headings
Numerical data are entered between &
separators, mathematical symbols are enclosed in a pair of $
, and each row ends with the newline command \\
.
The table is completed by closing the environment.
45 & 0.9998 & 0.0023$^\dagger$ & -1.46 & 0.13 \\
50 & 0.9998 & 0.0023$^\dagger$ & -1.62 & 0.13 \\
100 & 0.9999 & 0.0023$^\dagger$ & -3.27 & 0.13 \\
300 & 0.9998 & 0.0025 & -9.80 & 0.14 \\
500 & 0.9997 & 0.0026 & -16.34 & 0.15 \\
1000 & 1.0000 & 0.0032 & -32.72 & 0.18 \\
2000 & 0.9994 & 0.0054 & -65.67 & 0.31 \\
3000 & 1.000 & 0.011 & -98.66 & 0.62 \\
4000 & 0.999 & 0.013 & -131.74 & 0.78 \\
5000 & 0.999 & 0.016 & -164.77 & 0.90 \\
6000 & 0.998 & 0.017 & +162.15 & 0.99 \\
7000 & 0.997 & 0.018 & +129.0 & 1.1 \\
8000 & 0.997 & 0.018 & +95.9 & 1.1 \\
9000 & 0.996 & 0.018 & +62.7 & 1.1
\end{tabular}