mirror of
https://github.com/sphinx-doc/sphinx.git
synced 2025-02-25 18:55:22 -06:00
LaTeX: let \sphinxremovefinalcolon work also if no colon in input
This commit is contained in:
@@ -1498,6 +1498,16 @@ Macros
|
|||||||
\renewcommand\sphinxwarningtitle[1]{%
|
\renewcommand\sphinxwarningtitle[1]{%
|
||||||
\underline{\textbf{\sphinxremovefinalcolon{#1}}}\par
|
\underline{\textbf{\sphinxremovefinalcolon{#1}}}\par
|
||||||
}
|
}
|
||||||
|
\renewcommand{\sphinxnotetitle}[1]{%
|
||||||
|
\textit{\textbf{\sphinxremovefinalcolon{#1}}}\par\nobreak
|
||||||
|
% LaTeX syntax is complex and we would be better off using \hrule here.
|
||||||
|
{\parskip0pt\noindent}%
|
||||||
|
\raisebox{1ex}%
|
||||||
|
{\makebox[\linewidth]{\textcolor{sphinxnoteBorderColor}{\dotfill}}}
|
||||||
|
% It is complex to obtain nice vertical spacing for both a paragraph or
|
||||||
|
% a list following up; this set-up is better for a text paragraph next.
|
||||||
|
\par\vskip-\parskip
|
||||||
|
}
|
||||||
|
|
||||||
- More text styling:
|
- More text styling:
|
||||||
|
|
||||||
|
|||||||
@@ -19,15 +19,26 @@
|
|||||||
\let\sphinxerrortitle \sphinxnotetitle
|
\let\sphinxerrortitle \sphinxnotetitle
|
||||||
\def\sphinxseealsotitle#1{\sphinxstrong{#1}\par\nopagebreak}
|
\def\sphinxseealsotitle#1{\sphinxstrong{#1}\par\nopagebreak}
|
||||||
%
|
%
|
||||||
% A utility to remove a final colon
|
% A utility to remove a final colon. Removing last token is not easy in
|
||||||
% (one must be certain the semi-colon is there)
|
% LaTeX, and there are additional complications:
|
||||||
\protected\def\sphinxremovefinalcolon #1{%
|
% - some languages will make the : "active" in document body,
|
||||||
|
% - the generic admonition ends up using "note", so for \sphinxnotetitle to
|
||||||
|
% use it safely, the utility has to allow an input not having any final colon.
|
||||||
|
% - a bit far-fetched but maybe there is more than one colon inside the input
|
||||||
|
% (possible from a generic admonition title).
|
||||||
|
% Hence the scary code.
|
||||||
|
\def\sphinxremovefinalcolon#1{% #1 is the "active" : TeX token
|
||||||
|
\protected\def\sphinxremovefinalcolon ##1{%
|
||||||
% complications due to : possibly "active"
|
% complications due to : possibly "active"
|
||||||
\begingroup\ifnum\catcode`:=\active
|
\begingroup\ifnum\catcode`:=\active
|
||||||
\lccode`~=`:\lowercase{\def\x##1~}{##1}%
|
\def\x####1#1\relax{####1}%
|
||||||
\else\def\x##1:{##1}\fi
|
\else\def\x####1:\relax{####1}\fi
|
||||||
\expandafter\endgroup\x#1%
|
\expandafter\endgroup\x##1\relax
|
||||||
}%
|
% trick to let \x work also if input ##1 has no ending colon
|
||||||
|
\@gobblefour#1\relax:\relax\relax\relax
|
||||||
|
}%
|
||||||
|
}% end of wrapper to inject active :
|
||||||
|
\begingroup\catcode`:\active\expandafter\endgroup\sphinxremovefinalcolon:
|
||||||
% See doc/latex.rst for an example.
|
% See doc/latex.rst for an example.
|
||||||
|
|
||||||
% Some custom font markup commands.
|
% Some custom font markup commands.
|
||||||
|
|||||||
Reference in New Issue
Block a user