tweak title page some more

This commit is contained in:
Axel Kohlmeyer
2024-08-20 22:37:25 -04:00
parent 77f19f1dc9
commit 6db454a5e2

View File

@ -90,6 +90,16 @@ def get_lammps_version():
end_pos = line.find('"', start_pos)
return line[start_pos:end_pos]
def get_lammps_update():
import os
script_dir = os.path.dirname(os.path.realpath(__file__))
with open(os.path.join(LAMMPS_SOURCE_DIR, 'version.h'), 'r') as f:
line = f.readline()
line = f.readline()
start_pos = line.find('"')+1
end_pos = line.find('"', start_pos)
return line[start_pos:end_pos]
def get_git_info():
import subprocess,time
@ -290,6 +300,13 @@ rst_prolog = r"""
# -- Options for LaTeX output ---------------------------------------------
latex_engine = 'pdflatex'
if (get_lammps_update() == 'Development') or (get_lammps_update() == 'Maintenance'):
lammpsversion = format("\\newcommand{\\lammpsversion}{Git: %s}\n" \
% (get_git_info()))
else:
lammpsversion = format("\\newcommand{\\lammpsversion}{Release %s %s}\n" \
% (get_lammps_version(), get_lammps_update()))
latex_elements = {
# The paper size ('letterpaper' or 'a4paper').
#'papersize': 'letterpaper',
@ -299,7 +316,6 @@ latex_elements = {
# Additional stuff for the LaTeX preamble.
'preamble': r'''
\usepackage{xcolor}
\setcounter{tocdepth}{2}
\setcounter{part}{-1}
\renewcommand{\sfdefault}{ptm} % Use Times New Roman font for \textrm
@ -336,41 +352,6 @@ latex_elements = {
\DeclareMathSymbol{\Psi}{\mathalpha}{extraops}{"09}
\DeclareMathSymbol{\Omega}{\mathalpha}{extraops}{"0A}
% customized titlepage
\newcommand{\custommaketitle}{%
\hypersetup{pageanchor=false}% avoid duplicate destination warnings
\begin{titlepage}%
\let\footnotesize\small
\let\footnoterule\relax
\noindent\rule{\textwidth}{1pt}\par
\begingroup % for PDF information dictionary
\def\endgraf{ }\def\and{\& }%
\pdfstringdefDisableCommands{\def\\{, }}% overwrite hyperref setup
\hypersetup{pdfauthor={\@author}, pdftitle={\@title}}%
\endgroup
\begin{center}%
\sphinxlogo
\vfill
{\Huge LAMMPS Documentation \par}
{\LARGE Release 27Jun2024 \par}
\vfill\vfill
{\LARGE
\begin{tabular}[t]{c}
The LAMMPS Developers\\
\\
\Large{developers@lammps.org}$^*$\\
\end{tabular}\kern-\tabcolsep
\par}
\end{center}%\par
\begin{center}
\normalsize{${}^*$ see \hyperref[https://www.lammps.org/authors.html]{https://www.lammps.org/authors.html} for details}
\end{center}
\end{titlepage}%
\setcounter{footnote}{0}%
\clearpage
}
\renewcommand{\AA}{\mbox{\textrm{\r{A}}}}
% Make ToC number fields wider to accommodate sections with >= 100 subsections
% or >= 10 subsections with >= 10 subsubsections
@ -383,8 +364,37 @@ latex_elements = {
}
\makeatother
''',
'maketitle': r'''
\custommaketitle
'maketitle': lammpsversion + r'''
% customized titlepage
{%
\hypersetup{pageanchor=false}% avoid duplicate destination warnings
\begin{titlepage}%
\sffamily\bfseries
\begingroup % for PDF information dictionary
\def\endgraf{ }\def\and{\& }%
\pdfstringdefDisableCommands{\def\\{, }}% overwrite hyperref setup
\hypersetup{pdfauthor={The LAMMPS Developers}, pdftitle={LAMMPS Documentation}}%
\endgroup
\noindent\rule{\textwidth}{4pt}\par
\begin{center}%
\sphinxlogo
\vfill
{\Huge LAMMPS Documentation \par}
\vfill
{\LARGE \lammpsversion \par}
\vfill
{\LARGE The LAMMPS Developers \par}
{\Large developers@lammps.org $^*$ \par}
\vfill\vfill\vfill
{\normalsize ${}^*$ see
\sphinxhref{https://www.lammps.org/authors.html}{https://www.lammps.org/authors.html}
for details \par}
\end{center}
\noindent\rule{\textwidth}{4pt}\par
\end{titlepage}%
\setcounter{footnote}{0}%
\clearpage
}
''',
}
@ -405,19 +415,13 @@ latex_documents = [
# the title page.
latex_logo = "_static/lammps-logo-large.jpg"
# For "manual" documents, if this is true, then toplevel headings are parts,
# not chapters.
#latex_use_parts = False
latex_toplevel_sectioning = 'part'
# If true, show page references after internal links.
#latex_show_pagerefs = False
# If true, show URL addresses after external links.
latex_show_urls = 'no'
# latex_show_urls = 'footnote'
# Documents to append as an appendix to all manuals.
#latex_appendices = []
# If false, no module index is generated.
latex_domain_indices = False