Skip to content

Commit 8f9bac9

Browse files
committed
LaTeX: rename \sphinxnotetitle into \sphinxstylenotetitle (etc)
Follow-up to #11266. Using \sphinxstyle prefix looked a posteriori better, for coherency, although it is a bit long.
1 parent 64bf782 commit 8f9bac9

File tree

4 files changed

+73
-76
lines changed

4 files changed

+73
-76
lines changed

CHANGES

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -35,9 +35,9 @@ Features added
3535
* LaTeX: a command ``\sphinxbox`` for styling text elements with a (possibly
3636
rounded) box, optional background color and shadow, has been added.
3737
See :ref:`sphinxbox`. (refs: #11224)
38-
* LaTeX: add ``\sphinxnotetitle``, ..., ``\sphinxwarningtitle``, ..., for
39-
an extra layer of mark-up freeing up ``\sphinxstrong`` for other uses.
40-
See :ref:`latex-macros`. (refs: #11266)
38+
* LaTeX: add ``\sphinxstylenotetitle``, ..., ``\sphinxstylewarningtitle``, ...,
39+
for an extra layer of mark-up freeing up ``\sphinxstrong`` for other uses.
40+
See :ref:`latex-macros`. (refs: #11267)
4141
* LaTeX: :dudir:`note`, :dudir:`hint`, :dudir:`important` and :dudir:`tip` can
4242
now each be styled as the other admonitions, i.e. possibly with a background
4343
color, individual border widths and paddings, possibly rounded corners, and

doc/latex.rst

Lines changed: 48 additions & 49 deletions
Original file line numberDiff line numberDiff line change
@@ -1464,16 +1464,6 @@ Macros
14641464
``\sphinxsamedocref``; ``\emph{#1}``
14651465
``\sphinxparam``; ``\emph{#1}``
14661466
``\sphinxoptional``; ``[#1]`` with larger brackets, see source
1467-
``\sphinxnotetitle``; ``\sphinxstrong{#1}<space>``
1468-
``\sphinxhinttitle``; *idem*
1469-
``\sphinximportanttitle``; *idem*
1470-
``\sphinxtiptitle``; *idem*
1471-
``\sphinxwarningtitle``; *idem*
1472-
``\sphinxcautiontitle``; *idem*
1473-
``\sphinxattentiontitle``; *idem*
1474-
``\sphinxdangertitle``; *idem*
1475-
``\sphinxerrortitle``; *idem*
1476-
``\sphinxseealsotitle``; ``\sphinxstrong{#1}\par\nopagebreak``
14771467

14781468
.. versionadded:: 1.4.5
14791469
Use of ``\sphinx`` prefixed macro names to limit possibilities of conflict
@@ -1488,53 +1478,42 @@ Macros
14881478
.. versionadded:: 6.2.0
14891479
``\sphinxparam``, ``\sphinxsamedocref``
14901480

1491-
.. versionadded:: 6.2.0
1492-
``\sphinxnotetitle`` et al. The ``#1`` is the localized name of the
1493-
directive, with a final colon. Wrap it as ``\sphinxremovefinalcolon{#1}``
1494-
if this final colon is to be removed. Example:
1495-
1496-
.. code-block:: latex
1497-
1498-
\renewcommand\sphinxwarningtitle[1]{%
1499-
\underline{\textbf{\sphinxremovefinalcolon{#1}}}\par
1500-
}
1501-
\renewcommand{\sphinxnotetitle}[1]{%
1502-
\textit{\textbf{\sphinxremovefinalcolon{#1}}}\par\nobreak
1503-
% LaTeX syntax is complex and we would be better off using \hrule here.
1504-
{\parskip0pt\noindent}%
1505-
\raisebox{1ex}%
1506-
{\makebox[\linewidth]{\textcolor{sphinxnoteBorderColor}{\dotfill}}}
1507-
% It is complex to obtain nice vertical spacing for both a paragraph or
1508-
% a list following up; this set-up is better for a text paragraph next.
1509-
\par\vskip-\parskip
1510-
}
1511-
15121481
- More text styling:
15131482

15141483
.. csv-table::
15151484
:header: Name, ``maps argument #1 to:``
15161485
:align: left
15171486
:delim: ;
15181487

1519-
``\sphinxstyleindexentry``; ``\texttt{#1}``
1520-
``\sphinxstyleindexextra``; ``(\emph{#1})`` (with a space upfront)
1521-
``\sphinxstyleindexpageref``; ``, \pageref{#1}``
1522-
``\sphinxstyleindexpagemain``; ``\textbf{#1}``
1523-
``\sphinxstyleindexlettergroup``; ``{\Large\sffamily#1}\nopagebreak\vspace{1mm}``
1488+
``\sphinxstyleindexentry``; ``\texttt{#1}``
1489+
``\sphinxstyleindexextra``; ``(\emph{#1})`` (with a space upfront)
1490+
``\sphinxstyleindexpageref``; ``, \pageref{#1}``
1491+
``\sphinxstyleindexpagemain``; ``\textbf{#1}``
1492+
``\sphinxstyleindexlettergroup``; ``{\Large\sffamily#1}\nopagebreak\vspace{1mm}``
15241493
``\sphinxstyleindexlettergroupDefault``; check source, too long for here
1525-
``\sphinxstyletopictitle``; ``\textbf{#1}\par\medskip``
1526-
``\sphinxstylesidebartitle``; ``\textbf{#1}\par\medskip``
1527-
``\sphinxstyleothertitle``; ``\textbf{#1}``
1528-
``\sphinxstylesidebarsubtitle``; ``~\\\textbf{#1} \smallskip``
1529-
``\sphinxstyletheadfamily``; ``\sffamily`` (*this one has no argument*)
1530-
``\sphinxstyleemphasis``; ``\emph{#1}``
1531-
``\sphinxstyleliteralemphasis``; ``\emph{\sphinxcode{#1}}``
1532-
``\sphinxstylestrong``; ``\textbf{#1}``
1533-
``\sphinxstyleliteralstrong``; ``\sphinxbfcode{#1}``
1534-
``\sphinxstyleabbreviation``; ``\textsc{#1}``
1535-
``\sphinxstyleliteralintitle``; ``\sphinxcode{#1}``
1536-
``\sphinxstylecodecontinued``; ``{\footnotesize(#1)}}``
1537-
``\sphinxstylecodecontinues``; ``{\footnotesize(#1)}}``
1494+
``\sphinxstyletopictitle``; ``\textbf{#1}\par\medskip``
1495+
``\sphinxstylesidebartitle``; ``\textbf{#1}\par\medskip``
1496+
``\sphinxstyleothertitle``; ``\textbf{#1}``
1497+
``\sphinxstylesidebarsubtitle``; ``~\\\textbf{#1} \smallskip``
1498+
``\sphinxstyletheadfamily``; ``\sffamily`` (*this one has no argument*)
1499+
``\sphinxstyleemphasis``; ``\emph{#1}``
1500+
``\sphinxstyleliteralemphasis``; ``\emph{\sphinxcode{#1}}``
1501+
``\sphinxstylestrong``; ``\textbf{#1}``
1502+
``\sphinxstyleliteralstrong``; ``\sphinxbfcode{#1}``
1503+
``\sphinxstyleabbreviation``; ``\textsc{#1}``
1504+
``\sphinxstyleliteralintitle``; ``\sphinxcode{#1}``
1505+
``\sphinxstylecodecontinued``; ``{\footnotesize(#1)}}``
1506+
``\sphinxstylecodecontinues``; ``{\footnotesize(#1)}}``
1507+
``\sphinxstylenotetitle``; ``\sphinxstrong{#1}<space>``
1508+
``\sphinxstylehinttitle``; *idem*
1509+
``\sphinxstyleimportanttitle``; *idem*
1510+
``\sphinxstyletiptitle``; *idem*
1511+
``\sphinxstylewarningtitle``; *idem*
1512+
``\sphinxstylecautiontitle``; *idem*
1513+
``\sphinxstyleattentiontitle``; *idem*
1514+
``\sphinxstyledangertitle``; *idem*
1515+
``\sphinxstyleerrortitle``; *idem*
1516+
``\sphinxstyleseealsotitle``; ``\sphinxstrong{#1}\par\nopagebreak``
15381517

15391518
.. versionadded:: 1.5
15401519
These macros were formerly hard-coded as non customizable ``\texttt``,
@@ -1550,6 +1529,26 @@ Macros
15501529
.. versionadded:: 1.8
15511530
``\sphinxstyleindexlettergroup``, ``\sphinxstyleindexlettergroupDefault``.
15521531

1532+
.. versionadded:: 6.2.0
1533+
``\sphinxstylenotetitle`` et al. The ``#1`` is the localized name of the
1534+
directive, with a final colon. Wrap it as ``\sphinxremovefinalcolon{#1}``
1535+
if this final colon is to be removed. Examples:
1536+
1537+
.. code-block:: latex
1538+
1539+
\renewcommand\sphinxstylewarningtitle[1]{%
1540+
\underline{\textbf{\sphinxremovefinalcolon{#1}}}\par
1541+
}
1542+
\renewcommand{\sphinxstylenotetitle}[1]{%
1543+
\textit{\textbf{\sphinxremovefinalcolon{#1}}}\par\nobreak
1544+
% LaTeX syntax is complex and we would be better off using \hrule.
1545+
{\parskip0pt\noindent}%
1546+
\raisebox{1ex}%
1547+
{\makebox[\linewidth]{\textcolor{sphinxnoteBorderColor}{\dotfill}}}
1548+
% It is complex to obtain nice vertical spacing for both a paragraph
1549+
% or a list following up; this set-up is better for a paragraph next.
1550+
\par\vskip-\parskip
1551+
}
15531552

15541553
- ``\sphinxtableofcontents``: A wrapper (defined differently in
15551554
:file:`sphinxhowto.cls` and in :file:`sphinxmanual.cls`) of standard

sphinx/texinputs/sphinxlatexadmonitions.sty

Lines changed: 12 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -26,16 +26,14 @@
2626
%
2727
% - of course the various colour and dimension options handled via sphinx.sty
2828
%
29-
% - \sphinxstrong (for sphinxlightbox and sphinxheavybox)
30-
%
3129
% - dimension register \spx@image@maxheight from sphinxlatexgraphics.sty
3230
%
3331
% - \savenotes/\spewnotes from sphinxpackagefootnote (for sphinxheavybox)
3432
%
35-
% - \sphinxnotetitle, ..., \sphinxwarningtitle, etc... which are used by
33+
% - \sphinxstylenotetitle, ..., \sphinxstylewarningtitle, etc... which are used by
3634
% default in the corresponding sphinx<notice> environments to replace at 6.2.0
3735
% formerly hard-coded \sphinxstrong{#1}<space>
38-
% Their definitions are in sphinxlatexstyletext.sty. Also \sphinxseealsotitle
36+
% Their definitions are in sphinxlatexstyletext.sty.
3937

4038

4139
% Provides: (also in sphinxlatexliterals.sty)
@@ -44,7 +42,7 @@
4442
}
4543

4644
% Some are quite plain
47-
\newenvironment{sphinxseealso}[1]{\sphinxseealsotitle{#1}}{}
45+
\newenvironment{sphinxseealso}[1]{\sphinxstyleseealsotitle{#1}}{}
4846

4947
% This \dimen register is a legacy relic from Sphinx 1.5 which is used now
5048
% only for sphinxlightbox. It is set in the sphinxadmonition environment.
@@ -94,19 +92,19 @@
9492
% code in sphinxVerbatim.
9593
\newenvironment{sphinxnote}[1]
9694
{\edef\spx@env{sphinx\ifspx@opt@heavynote heavy\else light\fi box}%
97-
\expandafter\begin\expandafter{\spx@env}\sphinxnotetitle{#1}}
95+
\expandafter\begin\expandafter{\spx@env}\sphinxstylenotetitle{#1}}
9896
{\expandafter\end\expandafter{\spx@env}}
9997
\newenvironment{sphinxhint}[1]
10098
{\edef\spx@env{sphinx\ifspx@opt@heavyhint heavy\else light\fi box}%
101-
\expandafter\begin\expandafter{\spx@env}\sphinxhinttitle{#1}}
99+
\expandafter\begin\expandafter{\spx@env}\sphinxstylehinttitle{#1}}
102100
{\expandafter\end\expandafter{\spx@env}}
103101
\newenvironment{sphinximportant}[1]
104102
{\edef\spx@env{sphinx\ifspx@opt@heavyimportant heavy\else light\fi box}%
105-
\expandafter\begin\expandafter{\spx@env}\sphinximportanttitle{#1}}
103+
\expandafter\begin\expandafter{\spx@env}\sphinxstyleimportanttitle{#1}}
106104
{\expandafter\end\expandafter{\spx@env}}
107105
\newenvironment{sphinxtip}[1]
108106
{\edef\spx@env{sphinx\ifspx@opt@heavytip heavy\else light\fi box}%
109-
\expandafter\begin\expandafter{\spx@env}\sphinxtiptitle{#1}}
107+
\expandafter\begin\expandafter{\spx@env}\sphinxstyletiptitle{#1}}
110108
{\expandafter\end\expandafter{\spx@env}}
111109

112110
% warning/caution/attention/danger/error get more distinction
@@ -208,15 +206,15 @@
208206
% \renewcommand{\sphinxwarningtitle}[1]{\textbf{#1}\par\smallskip
209207
% {\color{sphinxwarningBorderColor}\hrule height1pt}\smallskip}
210208
\newenvironment{sphinxwarning}[1]
211-
{\begin{sphinxheavybox}\sphinxwarningtitle{#1}}{\end{sphinxheavybox}}
209+
{\begin{sphinxheavybox}\sphinxstylewarningtitle{#1}}{\end{sphinxheavybox}}
212210
\newenvironment{sphinxcaution}[1]
213-
{\begin{sphinxheavybox}\sphinxcautiontitle{#1}}{\end{sphinxheavybox}}
211+
{\begin{sphinxheavybox}\sphinxstylecautiontitle{#1}}{\end{sphinxheavybox}}
214212
\newenvironment{sphinxattention}[1]
215-
{\begin{sphinxheavybox}\sphinxattentiontitle{#1}}{\end{sphinxheavybox}}
213+
{\begin{sphinxheavybox}\sphinxstyleattentiontitle{#1}}{\end{sphinxheavybox}}
216214
\newenvironment{sphinxdanger}[1]
217-
{\begin{sphinxheavybox}\sphinxdangertitle{#1}}{\end{sphinxheavybox}}
215+
{\begin{sphinxheavybox}\sphinxstyledangertitle{#1}}{\end{sphinxheavybox}}
218216
\newenvironment{sphinxerror}[1]
219-
{\begin{sphinxheavybox}\sphinxerrortitle{#1}}{\end{sphinxheavybox}}
217+
{\begin{sphinxheavybox}\sphinxstyleerrortitle{#1}}{\end{sphinxheavybox}}
220218

221219
% the main dispatch for all types of notices
222220
\newenvironment{sphinxadmonition}[2]{% #1=type, #2=heading

sphinx/texinputs/sphinxlatexstyletext.sty

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -8,16 +8,16 @@
88

99
% But those arise rather from the default definitions of the respective
1010
% latex environments done in sphinxlatexadmonitions.sty
11-
\def\sphinxnotetitle#1{\sphinxstrong{#1} }
12-
\let\sphinxhinttitle \sphinxnotetitle % #1 holds the localized notice name
13-
\let\sphinximportanttitle\sphinxnotetitle % followed by a colon
14-
\let\sphinxtiptitle \sphinxnotetitle
15-
\let\sphinxwarningtitle \sphinxnotetitle
16-
\let\sphinxcautiontitle \sphinxnotetitle
17-
\let\sphinxattentiontitle\sphinxnotetitle
18-
\let\sphinxdangertitle \sphinxnotetitle
19-
\let\sphinxerrortitle \sphinxnotetitle
20-
\def\sphinxseealsotitle#1{\sphinxstrong{#1}\par\nopagebreak}
11+
\def\sphinxstylenotetitle #1{\sphinxstrong{#1} }
12+
\let\sphinxstylehinttitle \sphinxstylenotetitle % #1 holds the localized notice name
13+
\let\sphinxstyleimportanttitle\sphinxstylenotetitle % followed by a colon
14+
\let\sphinxstyletiptitle \sphinxstylenotetitle
15+
\let\sphinxstylewarningtitle \sphinxstylenotetitle
16+
\let\sphinxstylecautiontitle \sphinxstylenotetitle
17+
\let\sphinxstyleattentiontitle\sphinxstylenotetitle
18+
\let\sphinxstyledangertitle \sphinxstylenotetitle
19+
\let\sphinxstyleerrortitle \sphinxstylenotetitle
20+
\def\sphinxstyleseealsotitle#1{\sphinxstrong{#1}\par\nopagebreak}
2121
%
2222
% A utility to remove a final colon. Removing last token is not easy in
2323
% LaTeX, and there are additional complications:

0 commit comments

Comments
 (0)