Skip to content

Commit ed3f312

Browse files
committed
[macros] Introduce 'term.*' labels
1 parent a4994b4 commit ed3f312

File tree

2 files changed

+21
-4
lines changed

2 files changed

+21
-4
lines changed

source/macros.tex

+20-3
Original file line numberDiff line numberDiff line change
@@ -237,16 +237,33 @@
237237
\newcommand{\defnxname}[1]{\indextext{\idxxname{#1}}\xname{#1}}
238238
\newcommand{\defnlibxname}[1]{\indexlibrary{\idxxname{#1}}\xname{#1}}
239239

240+
% term.* labels
241+
\newcommand{\termlabel}[1]{\label{term.\temp}}
242+
% convert space-separated phrase to dot-separated label name
243+
\newcommand{\newtermlabelx}[1]{%
244+
{% remove all formatting instructions
245+
\let\idxcode=\nocode%
246+
\let\tcode=\nocode%
247+
\let\idxgram=\nocode%
248+
\let\fakegrammarterm=\nocode%
249+
\let\Cpp=\idxCpp%
250+
\let\oldconcept\oldconceptname%
251+
\renewcommand{\ntbs}{ntbs}%
252+
\renewcommand{\ntmbs}{ntmbs}%
253+
\StrSubstitute{#1}{ }{.}[\temp]%
254+
\termlabel{\temp}%
255+
}}
256+
240257
% Non-compound defined term.
241258
\newcommand{\defn}[1]{\defnx{#1}{#1}}
242259
% Defined term with different index entry.
243-
\newcommand{\defnx}[2]{\indexdefn{#2}\textit{#1}}
260+
\newcommand{\defnx}[2]{\indexdefn{#2}\newtermlabelx{#2}\textit{#1}}
244261
% Compound defined term with 'see' for primary term.
245262
% Usage: \defnadj{trivial}{class}
246-
\newcommand{\defnadj}[2]{\indextext{#1 #2|see{#2, #1}}\indexdefn{#2!#1}\textit{#1 #2}}
263+
\newcommand{\defnadj}[2]{\defnadjx{#1}{#2}{#2}}
247264
% Compound defined term with a different form for the primary noun.
248265
% Usage: \defnadjx{scalar}{types}{type}
249-
\newcommand{\defnadjx}[3]{\indextext{#1 #3|see{#3, #1}}\indexdefn{#3!#1}\textit{#1 #2}}
266+
\newcommand{\defnadjx}[3]{\indextext{#1 #3|see{#3, #1}}\indexdefn{#3!#1}\newtermlabelx{#1 #3}\textit{#1 #2}}
250267

251268
%%--------------------------------------------------
252269
%% allow line break if needed for justification

source/utilities.tex

+1-1
Original file line numberDiff line numberDiff line change
@@ -10319,7 +10319,7 @@
1031910319
\pnum
1032010320
For the purposes of subclause \ref{smartptr},
1032110321
a pointer type \tcode{Y*} is said to be
10322-
\defnx{compatible with}{compatible with!\idxcode{shared_ptr}}
10322+
\defnx{compatible with}{compatible with!\idxcode{\detokenize{shared_ptr}}}
1032310323
a pointer type \tcode{T*} when either
1032410324
\tcode{Y*} is convertible to \tcode{T*} or
1032510325
\tcode{Y} is \tcode{U[N]} and \tcode{T} is \cv{}~\tcode{U[]}.

0 commit comments

Comments
 (0)