Skip to content

Commit

Permalink
added starred \term* and \Term*
Browse files Browse the repository at this point in the history
  • Loading branch information
nichtich committed Dec 6, 2010
1 parent 2ad938a commit 3e93806
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 10 deletions.
29 changes: 19 additions & 10 deletions acroterm.dtx
Expand Up @@ -42,7 +42,7 @@ This work consists of the file acroterm.dtx
%</driver> %</driver>
%<package>\ProvidesPackage{acroterm} %<package>\ProvidesPackage{acroterm}
%<*package> %<*package>
[2010/11/19 v0.1 Manage and index acronyms and terms] [2010/12/06 v0.1b Manage and index acronyms and terms]
%</package> %</package>
% \end{macrocode} % \end{macrocode}
% %
Expand Down Expand Up @@ -275,27 +275,36 @@ This work consists of the file acroterm.dtx
% \subsection*{Main macros} % \subsection*{Main macros}
% %
% \begin{macro}{\term} % \begin{macro}{\term}
% \begin{macro}{\term*}
% Marks a term in normal form. The arguments are \oarg{index term}\marg{term}. % Marks a term in normal form. The arguments are \oarg{index term}\marg{term}.
% The starred version does not print anything, but only indexes the term.
% \begin{macrocode} % \begin{macrocode}
\newcommand{\term}[2][]{% \def\term{\@ifstar\term@index\term@show}
\newcommand{\term@index}[2][]{%
\ifthenelse{\isempty{#1}}% \ifthenelse{\isempty{#1}}%
{\sindex[idx]{#2}}{\sindex[idx]{#1}}% {\sindex[idx]{#2}}{\sindex[idx]{#1}}}
\termstyle{#2}} \newcommand{\term@show}[2][]{%
\term@index[#1]{#2}\termstyle{#2}}
% \end{macrocode} % \end{macrocode}
% \end{macro} % \end{macro}
% \end{macro}
% %
% \begin{macro}{\Term} % \begin{macro}{\Term}
% Marks a term in emphasized form. % \begin{macro}{\Term*}
% The arguments are \oarg{index term}\marg{term}. % Marks a term in emphasized form. The arguments are
% \oarg{index term}\marg{term}. The starred version does not print anything,
% but only indexes the term.
% \begin{macrocode} % \begin{macrocode}
\newcommand\Term[2][]{% \def\Term{\@ifstar\Term@index\Term@show}
\newcommand{\Term@index}[2][]{%
\ifthenelse{\isempty{#1}}% \ifthenelse{\isempty{#1}}%
{\sindex[idx]{#2|acrotermbfhp}}% {\sindex[idx]{#2|acrotermbfhp}}%
{\sindex[idx]{#1|acrotermbfhp}}% {\sindex[idx]{#1|acrotermbfhp}}}
\Termstyle{#2}% \newcommand{\Term@show}[2][]{%
} \Term@index[#1]{#2}\Termstyle{#2}}
% \end{macrocode} % \end{macrocode}
% \end{macro} % \end{macro}
% \end{macro}
% %
% \begin{macro}{\acro} % \begin{macro}{\acro}
% Marks an acronym in normal form. The argument is \marg{acronym}. % Marks an acronym in normal form. The argument is \marg{acronym}.
Expand Down
4 changes: 4 additions & 0 deletions example.tex
Expand Up @@ -13,6 +13,8 @@
It contains some acronyms like \aterm{RTFM}{read the f*cking manual} and the It contains some acronyms like \aterm{RTFM}{read the f*cking manual} and the
non-explained \acro{FOO}, some terms like \tacro{user-centered design}{UCD} non-explained \acro{FOO}, some terms like \tacro{user-centered design}{UCD}
and `\term{buzzword}', and the two indexes. and `\term{buzzword}', and the two indexes.
\term*{foo}\Term*{Bar}% not printed
\Term{Dummy} is also an important term.


\printsubindex[idx] \printsubindex[idx]
\printsubindex[acronym] \printsubindex[acronym]
Expand All @@ -23,6 +25,8 @@
for \acroexpand{RTFM}, and the term \term{user-centered design} to test for \acroexpand{RTFM}, and the term \term{user-centered design} to test
additional references. additional references.


\Acro{RTFM}

\acroexpand[This is an expanded acronym: ]{UCD} \acroexpand[This is an expanded acronym: ]{UCD}
\acroexpand[This is an expanded acronym: ]{XYZ} \acroexpand[This is an expanded acronym: ]{XYZ}


Expand Down

0 comments on commit 3e93806

Please sign in to comment.