From bff7461f8580090d5d8a135bd48c35f7dc0af297 Mon Sep 17 00:00:00 2001 From: JDBetteridge Date: Thu, 19 Jan 2023 11:38:47 +0000 Subject: [PATCH] USe poptitle add logo, compile with lualatex --- docs/source/_static/poptitle.sty | 105 +++++++++++++++++++++++++++++++ docs/source/conf.py | 43 ++++++++++--- 2 files changed, 138 insertions(+), 10 deletions(-) create mode 100644 docs/source/_static/poptitle.sty diff --git a/docs/source/_static/poptitle.sty b/docs/source/_static/poptitle.sty new file mode 100644 index 0000000000..09eb223cc5 --- /dev/null +++ b/docs/source/_static/poptitle.sty @@ -0,0 +1,105 @@ +\NeedsTeXFormat{LaTeX2e} +\ProvidesPackage{poptitle}[2023/01/18 Firedrake manual title page.] + +\RequirePackage{fontspec} +\setsansfont{TeX Gyre Heros} +\RequirePackage[british]{babel} +\RequirePackage[utf8]{inputenc} +\RequirePackage[absolute]{textpos} +\RequirePackage{xcolor} +\RequirePackage{graphicx} +\RequirePackage{etoolbox} +\RequirePackage[ + type={CC}, + modifier={by}, + version={4.0}, +]{doclicense} +\RequirePackage{fmtcount} +\RequirePackage{hyperref} +\RequirePackage{titling} + +\newcommand{\editions}{} +\newcommand{\edition}[1]{\listadd{\editions}{#1}} +\makeatletter +\providecommand\subtitle[1]{\renewcommand\thesubtitle{#1}} +\newcommand\thesubtitle{\@latex@error{No \noexpand\subtitle given}\@ehc} +\makeatother + +\setlength{\TPHorizModule}{1mm} +\setlength{\TPVertModule}{\TPHorizModule} +\textblockorigin{0mm}{0mm} + + +\definecolor{imperialblue}{cmyk}{1,.61,0,.45} + +\newcommand{\poptitlepages}{ +\clearpage +\thispagestyle{empty} + \newcounter{edcnt} + \setcounter{edcnt}{0} + \renewcommand*{\do}[1]{\stepcounter{edcnt} +\ifdefined\thisedition + \renewcommand{\thisedition}{\Ordinalstring{edcnt} edition} +\else + \newcommand{\thisedition}{} +\fi +} + \dolistloop{\editions} + +% \begin{textblock}{70}(17.5,17.5) +% \noindent\includegraphics[width=70mm]{imperial.pdf} +% \end{textblock} +% \begin{textblock}{210}(0,279) +% \noindent\rule{210mm}{.5mm} +% \end{textblock} +% \begin{textblock}{30}(190,-5) +% {\color{imperialblue} +% \noindent\rule[-5mm]{21mm}{300mm}} +% \end{textblock} +% \begin{textblock}{210}(17.5,284.5) +% {\sffamily\fontsize{25}{30}\selectfont +% \noindent Course Notes in Mathematics} +% \end{textblock} +% \begin{textblock}{30}(185,284.5) +% {\sffamily\fontsize{25}{30}\selectfont\centering\color{white}\bfseries +% \thevolcnt + +% } +% %\rule{15mm,297mm} +%\end{textblock} +\begin{textblock}{154}(17.5,74.25) + \setlength{\parskip}{2ex} + {\sffamily\fontsize{25}{30}\selectfont\noindent\thetitle} + + {\sffamily\fontsize{17}{20}\selectfont\noindent\thesubtitle + \vspace{\parskip} + + \noindent\Large\theauthor + \vspace{7\parskip} + + \noindent{\itshape\thisedition}} +\end{textblock} + +\mbox{} +\pagebreak + +\begin{textblock}{146}[0,1](17.5,230.5) + { + %\hypersetup{urlcolor=imperialblue} + \sffamily\fontsize{12}{14}\selectfont + \setcounter{edcnt}{0} + \renewcommand*{\do}[1]{\stepcounter{edcnt}\noindent\Ordinalstring{edcnt} edition: ##1 + \vspace{1ex} + + } + \dolistloop{\editions} + \vspace{2ex} + \noindent\copyright\ \theauthor + \doclicenseThis + } +\end{textblock} +\mbox{} +\setcounter{page}{0} +\thispagestyle{empty} +\clearpage +} diff --git a/docs/source/conf.py b/docs/source/conf.py index a3cdf6b52e..ac9fcbac98 100644 --- a/docs/source/conf.py +++ b/docs/source/conf.py @@ -186,6 +186,12 @@ # -- Options for LaTeX output -------------------------------------------- +latex_engine = 'lualatex' + +latex_additional_files = [ + '_static/poptitle.sty' + ] + latex_elements = { # The paper size ('letterpaper' or 'a4paper'). 'papersize': 'a4paper', @@ -193,38 +199,54 @@ # The font size ('10pt', '11pt' or '12pt'). #'pointsize': '10pt', + 'babel': r'\usepackage[british]{babel}', + # Additional stuff for the LaTeX preamble. 'preamble': r'''\newcommand{\require}[1]{} \usepackage{cancel} %\sphinxDUC{2730}{\ding{80}} -\sphinxDUC{27F6}{$\rightarrow$} -\sphinxDUC{2208}{$\in$} -\sphinxDUC{2200}{$\forall$} -\sphinxDUC{2218}{$\circ$} -\sphinxDUC{22C5}{$\cdot$} -\sphinxDUC{25A3}{$\boxdot$} +%\sphinxDUC{27F6}{$\rightarrow$} +%\sphinxDUC{2208}{$\in$} +%\sphinxDUC{2200}{$\forall$} +%\sphinxDUC{2218}{$\circ$} +%\sphinxDUC{22C5}{$\cdot$} +%\sphinxDUC{25A3}{$\boxdot$} % Sphinx equivalent of % \DeclareUnicodeCharacter{}{} + +% The default sphinx colouring colours a lot of links that are actually dead in +% the book version. +\definecolor{internallinkcolor}{HTML}{c52b03} +\definecolor{externallinkcolor}{HTML}{e55d05} +%\hypersetup{linkcolor=internallinkcolor} +\hypersetup{linkcolor=black} +%\hypersetup{urlcolor=externallinkcolor} +\hypersetup{urlcolor=black} +\usepackage{poptitle} +\subtitle{} +\edition{2023} ''', - 'extrapackages': r'''\usepackage{mathtools}''' + 'extrapackages': r'''\usepackage{mathtools}''', + + 'maketitle' : r'\poptitlepages' } # Grouping the document tree into LaTeX files. List of tuples # (source start file, target name, title, author, documentclass [howto/manual]). latex_documents = [ - ('index', 'Firedrake.tex', u'Firedrake Documentation', + ('index', 'Firedrake.tex', u'User Manual', u'the Firedrake team', 'manual'), ] # The name of an image file (relative to this directory) to place at the top of # the title page. -#latex_logo = None +latex_logo = '_themes/firedrake/static/banner.png' # For "manual" documents, if this is true, then toplevel headings are parts, # not chapters. -#latex_use_parts = False +latex_use_parts = True # If true, show page references after internal links. #latex_show_pagerefs = False @@ -237,6 +259,7 @@ # If false, no module index is generated. #latex_domain_indices = True +latex_docclass = {"manual": "book"} # -- Options for manual page output --------------------------------------