Permalink
Browse files

added starred \term* and \Term*

  • Loading branch information...
1 parent 2ad938a commit 3e93806dc0e2eb78547f60aff007c9b3bd1f2033 @nichtich committed Dec 6, 2010
Showing with 23 additions and 10 deletions.
  1. +19 −10 acroterm.dtx
  2. +4 −0 example.tex
View
@@ -42,7 +42,7 @@ This work consists of the file acroterm.dtx
%</driver>
%<package>\ProvidesPackage{acroterm}
%<*package>
- [2010/11/19 v0.1 Manage and index acronyms and terms]
+ [2010/12/06 v0.1b Manage and index acronyms and terms]
%</package>
% \end{macrocode}
%
@@ -275,27 +275,36 @@ This work consists of the file acroterm.dtx
% \subsection*{Main macros}
%
% \begin{macro}{\term}
+% \begin{macro}{\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}
-\newcommand{\term}[2][]{%
+\def\term{\@ifstar\term@index\term@show}
+\newcommand{\term@index}[2][]{%
\ifthenelse{\isempty{#1}}%
- {\sindex[idx]{#2}}{\sindex[idx]{#1}}%
- \termstyle{#2}}
+ {\sindex[idx]{#2}}{\sindex[idx]{#1}}}
+\newcommand{\term@show}[2][]{%
+ \term@index[#1]{#2}\termstyle{#2}}
% \end{macrocode}
% \end{macro}
+% \end{macro}
%
% \begin{macro}{\Term}
-% Marks a term in emphasized form.
-% The arguments are \oarg{index term}\marg{term}.
+% \begin{macro}{\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}
-\newcommand\Term[2][]{%
+\def\Term{\@ifstar\Term@index\Term@show}
+\newcommand{\Term@index}[2][]{%
\ifthenelse{\isempty{#1}}%
{\sindex[idx]{#2|acrotermbfhp}}%
- {\sindex[idx]{#1|acrotermbfhp}}%
- \Termstyle{#2}%
-}
+ {\sindex[idx]{#1|acrotermbfhp}}}
+\newcommand{\Term@show}[2][]{%
+ \Term@index[#1]{#2}\Termstyle{#2}}
% \end{macrocode}
% \end{macro}
+% \end{macro}
%
% \begin{macro}{\acro}
% Marks an acronym in normal form. The argument is \marg{acronym}.
View
@@ -13,6 +13,8 @@
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}
and `\term{buzzword}', and the two indexes.
+\term*{foo}\Term*{Bar}% not printed
+\Term{Dummy} is also an important term.
\printsubindex[idx]
\printsubindex[acronym]
@@ -23,6 +25,8 @@
for \acroexpand{RTFM}, and the term \term{user-centered design} to test
additional references.
+\Acro{RTFM}
+
\acroexpand[This is an expanded acronym: ]{UCD}
\acroexpand[This is an expanded acronym: ]{XYZ}

0 comments on commit 3e93806

Please sign in to comment.