doc: improve latex look and feel

This patch improves the general look and feel of the LaTeX (PDF)
documentation build. Changes include:

- A custom title with relevant information has been created
- Some colors have been adjusted to match those in the web template
- Charter font family is used

Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
This commit is contained in:
Gerard Marull-Paretas 2021-07-22 16:14:51 +02:00 committed by Anas Nashif
commit 2f5a9d033d
4 changed files with 79 additions and 4 deletions

BIN
doc/_static/images/logo-latex.pdf vendored Normal file

Binary file not shown.

15
doc/_static/latex/preamble.tex vendored Normal file
View file

@ -0,0 +1,15 @@
% LaTeX documentation preamble
%
% Copyright (c) 2021 Nordic Semiconductor ASA
% SPDX-License-Identifier: Apache-2.0
\usepackage[some]{background}
\usepackage{sectsty}
\definecolor{bg-color}{HTML}{333f67}
\setcounter{tocdepth}{2}
\addto\captionsenglish{\renewcommand{\contentsname}{Table of contents}}
\allsectionsfont{\color{bg-color}}

44
doc/_static/latex/title.tex vendored Normal file
View file

@ -0,0 +1,44 @@
% LaTeX documentation title page
%
% Copyright (c) 2021 Nordic Semiconductor ASA
% SPDX-License-Identifier: Apache-2.0
\makeatletter
\newgeometry{top=3cm,left=0cm,right=0cm,bottom=2.5cm}
\backgroundsetup{
scale=2.3,
contents={\sphinxlogo},
opacity=0.2,
angle=0,
position={0.25\textwidth,-0.4\textheight}
}
\BgThispage
\begin{minipage}{2cm}
\color{bg-color} \rule{2cm}{1.7cm}
\end{minipage}
\hspace{0.2cm}
\begin{minipage}{3cm}
\sphinxlogo
\end{minipage}
\hspace{0.2cm}
\begin{minipage}{15cm}
\Huge \textbf{\@title}\\
\LARGE \py@release\releaseinfo
\end{minipage}
\vspace{21cm}
\begin{flushright}
\begin{minipage}{7cm}
\large \@author\\\@date
\end{minipage}
\begin{minipage}{1.5cm}
\color{bg-color} \rule{1.5cm}{1.3cm}
\end{minipage}
\end{flushright}
\restoregeometry
\makeatother

View file

@ -37,7 +37,7 @@ except ImportError:
project = "Zephyr Project"
copyright = "2015-2021 Zephyr Project members and individual contributors"
author = "The Zephyr Project"
author = "The Zephyr Project Contributors"
# parse version from 'VERSION' file
with open(ZEPHYR_BASE / "VERSION") as f:
@ -62,6 +62,8 @@ with open(ZEPHYR_BASE / "VERSION") as f:
if extra:
version += "-" + extra
release = version
# -- General configuration ------------------------------------------------
extensions = [
@ -150,11 +152,25 @@ html_context = {
# -- Options for LaTeX output ---------------------------------------------
latex_elements = {
"preamble": r"\setcounter{tocdepth}{2}",
"papersize": "a4paper",
"maketitle": open(ZEPHYR_BASE / "doc" / "_static" / "latex" / "title.tex").read(),
"preamble": open(ZEPHYR_BASE / "doc" / "_static" / "latex" / "preamble.tex").read(),
"fontpkg": r"\usepackage{charter}",
"sphinxsetup": ",".join(
(
# NOTE: colors match those found in light.css stylesheet
"verbatimwithframe=false",
"VerbatimColor={HTML}{f0f2f4}",
"InnerLinkColor={HTML}{2980b9}",
"warningBgColor={HTML}{e9a499}",
"warningborder=0pt",
r"HeaderFamily=\rmfamily\bfseries",
)
),
}
latex_logo = str(ZEPHYR_BASE / "doc" / "_static" / "images" / "logo-latex.pdf")
latex_documents = [
("index-tex", "zephyr.tex", "Zephyr Project Documentation", "many", "manual"),
("index-tex", "zephyr.tex", "Zephyr Project Documentation", author, "manual"),
]
# -- Options for zephyr.doxyrunner plugin ---------------------------------