xref: /freebsd/crypto/krb5/doc/pdf/sphinxlatexstyletext.sty (revision 7f2fe78b9dd5f51c821d771b63d2e096f6fd49e9)
1*7f2fe78bSCy Schubert%% TEXT STYLING
2*7f2fe78bSCy Schubert%
3*7f2fe78bSCy Schubert% change this info string if making any custom modification
4*7f2fe78bSCy Schubert\ProvidesFile{sphinxlatexstyletext.sty}[2021/01/27 text styling]
5*7f2fe78bSCy Schubert
6*7f2fe78bSCy Schubert% Basically everything here consists of macros which are part of the latex
7*7f2fe78bSCy Schubert% markup produced by the Sphinx latex writer
8*7f2fe78bSCy Schubert
9*7f2fe78bSCy Schubert% Some custom font markup commands.
10*7f2fe78bSCy Schubert\protected\def\sphinxstrong#1{\textbf{#1}}
11*7f2fe78bSCy Schubert\protected\def\sphinxcode#1{\texttt{#1}}
12*7f2fe78bSCy Schubert\protected\def\sphinxbfcode#1{\textbf{\sphinxcode{#1}}}
13*7f2fe78bSCy Schubert\protected\def\sphinxemail#1{\textsf{#1}}
14*7f2fe78bSCy Schubert\protected\def\sphinxtablecontinued#1{\textsf{#1}}
15*7f2fe78bSCy Schubert\protected\def\sphinxtitleref#1{\emph{#1}}
16*7f2fe78bSCy Schubert\protected\def\sphinxmenuselection#1{\emph{#1}}
17*7f2fe78bSCy Schubert\protected\def\sphinxguilabel#1{\emph{#1}}
18*7f2fe78bSCy Schubert\protected\def\sphinxkeyboard#1{\sphinxcode{#1}}
19*7f2fe78bSCy Schubert\protected\def\sphinxaccelerator#1{\underline{#1}}
20*7f2fe78bSCy Schubert\protected\def\sphinxcrossref#1{\emph{#1}}
21*7f2fe78bSCy Schubert\protected\def\sphinxtermref#1{\emph{#1}}
22*7f2fe78bSCy Schubert% \optional is used for ``[, arg]``, i.e. desc_optional nodes.
23*7f2fe78bSCy Schubert\long\protected\def\sphinxoptional#1{%
24*7f2fe78bSCy Schubert  {\textnormal{\Large[}}{#1}\hspace{0.5mm}{\textnormal{\Large]}}}
25*7f2fe78bSCy Schubert
26*7f2fe78bSCy Schubert% additional customizable styling
27*7f2fe78bSCy Schubert\def\sphinxstyleindexentry   #1{\texttt{#1}}
28*7f2fe78bSCy Schubert\def\sphinxstyleindexextra   #1{ (\emph{#1})}
29*7f2fe78bSCy Schubert\def\sphinxstyleindexpageref #1{, \pageref{#1}}
30*7f2fe78bSCy Schubert\def\sphinxstyleindexpagemain#1{\textbf{#1}}
31*7f2fe78bSCy Schubert\def\spxentry{\@backslashchar spxentry}% let to \sphinxstyleindexentry in index
32*7f2fe78bSCy Schubert\def\spxextra{\@backslashchar spxextra}% let to \sphinxstyleindexextra in index
33*7f2fe78bSCy Schubert\def\sphinxstyleindexlettergroup #1%
34*7f2fe78bSCy Schubert    {{\Large\sffamily#1}\nopagebreak\vspace{1mm}}
35*7f2fe78bSCy Schubert\def\sphinxstyleindexlettergroupDefault #1%
36*7f2fe78bSCy Schubert    {{\Large\sffamily\sphinxnonalphabeticalgroupname}\nopagebreak\vspace{1mm}}
37*7f2fe78bSCy Schubert\protected\def\sphinxstyletopictitle   #1{\textbf{#1}\par\medskip}
38*7f2fe78bSCy Schubert\let\sphinxstylesidebartitle\sphinxstyletopictitle
39*7f2fe78bSCy Schubert\protected\def\sphinxstyleothertitle   #1{\textbf{#1}}
40*7f2fe78bSCy Schubert\protected\def\sphinxstylesidebarsubtitle #1{~\\\textbf{#1} \smallskip}
41*7f2fe78bSCy Schubert% \text.. commands do not allow multiple paragraphs
42*7f2fe78bSCy Schubert\protected\def\sphinxstyletheadfamily    {\sffamily}
43*7f2fe78bSCy Schubert\protected\def\sphinxstyleemphasis     #1{\emph{#1}}
44*7f2fe78bSCy Schubert\protected\def\sphinxstyleliteralemphasis#1{\emph{\sphinxcode{#1}}}
45*7f2fe78bSCy Schubert\protected\def\sphinxstylestrong       #1{\textbf{#1}}
46*7f2fe78bSCy Schubert\protected\def\sphinxstyleliteralstrong#1{\sphinxbfcode{#1}}
47*7f2fe78bSCy Schubert\protected\def\sphinxstyleabbreviation #1{\textsc{#1}}
48*7f2fe78bSCy Schubert\protected\def\sphinxstyleliteralintitle#1{\sphinxcode{#1}}
49*7f2fe78bSCy Schubert\newcommand*\sphinxstylecodecontinued[1]{\footnotesize(#1)}%
50*7f2fe78bSCy Schubert\newcommand*\sphinxstylecodecontinues[1]{\footnotesize(#1)}%
51*7f2fe78bSCy Schubert% figure legend comes after caption and may contain arbitrary body elements
52*7f2fe78bSCy Schubert\newenvironment{sphinxlegend}{\par\small}{\par}
53*7f2fe78bSCy Schubert% reduce hyperref "Token not allowed in a PDF string" warnings on PDF builds
54*7f2fe78bSCy Schubert\AtBeginDocument{\pdfstringdefDisableCommands{%
55*7f2fe78bSCy Schubert% all "protected" macros possibly ending up in section titles should be here
56*7f2fe78bSCy Schubert% TODO: examine if \sphinxhref, \sphinxurl, \sphinnolinkurl should be handled
57*7f2fe78bSCy Schubert    \let\sphinxstyleemphasis        \@firstofone
58*7f2fe78bSCy Schubert    \let\sphinxstyleliteralemphasis \@firstofone
59*7f2fe78bSCy Schubert    \let\sphinxstylestrong          \@firstofone
60*7f2fe78bSCy Schubert    \let\sphinxstyleliteralstrong   \@firstofone
61*7f2fe78bSCy Schubert    \let\sphinxstyleabbreviation    \@firstofone
62*7f2fe78bSCy Schubert    \let\sphinxstyleliteralintitle  \@firstofone
63*7f2fe78bSCy Schubert    \let\sphinxupquote  \@firstofone
64*7f2fe78bSCy Schubert    \let\sphinxstrong   \@firstofone
65*7f2fe78bSCy Schubert    \let\sphinxcode     \@firstofone
66*7f2fe78bSCy Schubert    \let\sphinxbfcode   \@firstofone
67*7f2fe78bSCy Schubert    \let\sphinxemail    \@firstofone
68*7f2fe78bSCy Schubert    \let\sphinxcrossref \@firstofone
69*7f2fe78bSCy Schubert    \let\sphinxtermref  \@firstofone
70*7f2fe78bSCy Schubert    \let\sphinxhyphen\sphinxhyphenforbookmarks
71*7f2fe78bSCy Schubert}}
72*7f2fe78bSCy Schubert
73*7f2fe78bSCy Schubert% Special characters
74*7f2fe78bSCy Schubert%
75*7f2fe78bSCy Schubert% This definition prevents en-dash and em-dash TeX ligatures.
76*7f2fe78bSCy Schubert%
77*7f2fe78bSCy Schubert% It inserts a potential breakpoint after the hyphen. This is to keep in sync
78*7f2fe78bSCy Schubert% with behavior in code-blocks, parsed and inline literals. For a breakpoint
79*7f2fe78bSCy Schubert% before the hyphen use \leavevmode\kern\z@- (within \makeatletter/\makeatother)
80*7f2fe78bSCy Schubert\protected\def\sphinxhyphen#1{-\kern\z@}
81*7f2fe78bSCy Schubert% The {} from texescape mark-up is kept, else -- gives en-dash in PDF bookmark
82*7f2fe78bSCy Schubert\def\sphinxhyphenforbookmarks{-}
83*7f2fe78bSCy Schubert
84*7f2fe78bSCy Schubert% For curly braces inside \index macro
85*7f2fe78bSCy Schubert\def\sphinxleftcurlybrace{\{}
86*7f2fe78bSCy Schubert\def\sphinxrightcurlybrace{\}}
87*7f2fe78bSCy Schubert
88*7f2fe78bSCy Schubert% Declare Unicode characters used by linux tree command to pdflatex utf8/utf8x
89*7f2fe78bSCy Schubert\def\spx@bd#1#2{%
90*7f2fe78bSCy Schubert  \leavevmode
91*7f2fe78bSCy Schubert  \begingroup
92*7f2fe78bSCy Schubert  \ifx\spx@bd@height   \@undefined\def\spx@bd@height{\baselineskip}\fi
93*7f2fe78bSCy Schubert  \ifx\spx@bd@width    \@undefined\setbox0\hbox{0}\def\spx@bd@width{\wd0 }\fi
94*7f2fe78bSCy Schubert  \ifx\spx@bd@thickness\@undefined\def\spx@bd@thickness{.6\p@}\fi
95*7f2fe78bSCy Schubert  \ifx\spx@bd@lower    \@undefined\def\spx@bd@lower{\dp\strutbox}\fi
96*7f2fe78bSCy Schubert  \lower\spx@bd@lower#1{#2}%
97*7f2fe78bSCy Schubert  \endgroup
98*7f2fe78bSCy Schubert}%
99*7f2fe78bSCy Schubert\@namedef{sphinx@u2500}% BOX DRAWINGS LIGHT HORIZONTAL
100*7f2fe78bSCy Schubert  {\spx@bd{\vbox to\spx@bd@height}
101*7f2fe78bSCy Schubert          {\vss\hrule\@height\spx@bd@thickness
102*7f2fe78bSCy Schubert                     \@width\spx@bd@width\vss}}%
103*7f2fe78bSCy Schubert\@namedef{sphinx@u2502}% BOX DRAWINGS LIGHT VERTICAL
104*7f2fe78bSCy Schubert  {\spx@bd{\hb@xt@\spx@bd@width}
105*7f2fe78bSCy Schubert          {\hss\vrule\@height\spx@bd@height
106*7f2fe78bSCy Schubert                     \@width \spx@bd@thickness\hss}}%
107*7f2fe78bSCy Schubert\@namedef{sphinx@u2514}% BOX DRAWINGS LIGHT UP AND RIGHT
108*7f2fe78bSCy Schubert  {\spx@bd{\hb@xt@\spx@bd@width}
109*7f2fe78bSCy Schubert          {\hss\raise.5\spx@bd@height
110*7f2fe78bSCy Schubert           \hb@xt@\z@{\hss\vrule\@height.5\spx@bd@height
111*7f2fe78bSCy Schubert                                \@width \spx@bd@thickness\hss}%
112*7f2fe78bSCy Schubert           \vbox to\spx@bd@height{\vss\hrule\@height\spx@bd@thickness
113*7f2fe78bSCy Schubert                                            \@width.5\spx@bd@width\vss}}}%
114*7f2fe78bSCy Schubert\@namedef{sphinx@u251C}% BOX DRAWINGS LIGHT VERTICAL AND RIGHT
115*7f2fe78bSCy Schubert  {\spx@bd{\hb@xt@\spx@bd@width}
116*7f2fe78bSCy Schubert          {\hss
117*7f2fe78bSCy Schubert           \hb@xt@\z@{\hss\vrule\@height\spx@bd@height
118*7f2fe78bSCy Schubert                                \@width \spx@bd@thickness\hss}%
119*7f2fe78bSCy Schubert           \vbox to\spx@bd@height{\vss\hrule\@height\spx@bd@thickness
120*7f2fe78bSCy Schubert                                            \@width.5\spx@bd@width\vss}}}%
121*7f2fe78bSCy Schubert\protected\def\sphinxunichar#1{\@nameuse{sphinx@u#1}}%
122*7f2fe78bSCy Schubert
123*7f2fe78bSCy Schubert% Tell TeX about pathological hyphenation cases:
124*7f2fe78bSCy Schubert\hyphenation{Base-HTTP-Re-quest-Hand-ler}
125*7f2fe78bSCy Schubert
126*7f2fe78bSCy Schubert\endinput
127