% \iffalse % %<*internal> \begingroup % %<*batchfile> \input docstrip.tex \keepsilent \preamble The Acroterm package Copyright (C) 2010 by Jakob Voss Distributable under the LaTeX Project Public License, version 1.3c or higher (your choice). The latest version of this license is at: http://www.latex-project.org/lppl.txt This work is "maintained" (as per LPPL maintenance status) by Jakob Voss. This work consists of the file acroterm.dtx and the derived files acroterm.sty, acroterm.ins, and acroterm.pdf. \endpreamble \askforoverwritefalse \generate{\file{acroterm.sty}{\from{acroterm.dtx}{package}}} % %\endbatchfile %<*internal> \generate{\file{acroterm.ins}{\from{acroterm.dtx}{batchfile}}} \def\tmpa{plain} \ifx\tmpa\fmtname\endgroup\expandafter\bye\fi \endgroup % % % \begin{macrocode} %<*driver> \ProvidesFile{acroterm.dtx} % %\ProvidesPackage{acroterm} %<*package> [2010/11/19 v0.1 Manage and index acronyms and terms] % % \end{macrocode} % %<*driver> \documentclass{ltxdoc} \usepackage{acroterm} \usepackage[ pdfborder={0 0 0},colorlinks, linkcolor=blue, citecolor=green, urlcolor=magenta ]{hyperref} \newcommand*\pkg[1]{\texttt{#1}} \setlength\parindent{0pt} \begin{document} \DocInput{\jobname.dtx} \end{document} % % % \fi % % \errorcontextlines=999 % % \GetFileInfo{\jobname.sty} % % \title{The \pkg{\jobname} package} % \author{Jakob Voss} % \date{\filedate ~ \fileversion} % % \maketitle % \tableofcontents % \setlength\parskip{7pt} % % \section{Introduction} % % There are several packages to manage acronyms in \TeX. CTAN lists at least % \pkg{acronym},\footnote{% % \url{http://www.ctan.org/tex-archive/macros/latex/contrib/acronym/}} % \pkg{acromake},\footnote{% % \url{http://www.ctan.org/tex-archive/macros/latex/contrib/acromake/}}, % \pkg{glosstex},\footnote{% % \url{http://www.ctan.org/tex-archive/support/glosstex/}} and % \pkg{glossary}.\footnote{% % \url{http://www.ctan.org/tex-archive/macros/latex/contrib/glossary/}} % These packages let you define acronyms, that can be expanded automatically. % But you rarely control when to expand, and defining acronyms can be annoying. % The \pkg{\jobname} package lets you naturally use acronyms and technical % terms in you document. You can mark up acronyms (\verb|\acro|) and terms % (\verb|\term|) as such, to get them formatted consistently and to include % them in an index. In addition you can connect acronyms and terms that % belong together. You fully control, where a term is used in full form, % and where it is used as acronym. Tracking the first ocurrence of a term % is not the primary goal of this package, but may implemented in a later % version. % % The current version of this package is a developer version that still depends % on the packages \pkg{splitidx} and \pkg{hyperref}. Please load \pkg{acroterm} % between the two. % % A small example is included in this package in file \verb|example.tex|. % % \section{Description} % % Essentially, this package provides four macros to mark terms, acronyms, and both: % % \begin{tabular}{lcl} % \verb|\acro{SNAFU}| & $\longrightarrow$ & \acro{SNAFU} \\ % \verb|\term{Potrzebie}| & $\longrightarrow$ & \term{Potrzebie} \\ % \verb|\tacro{Do it yourself}{DIY}| & $\longrightarrow$ & \tacro{Do it yourself}{DIY} \\ % \verb|\aterm{DIY}{Do it yourself}| & $\longrightarrow$ & \aterm{DIY}{Do it yourself} \\ % \end{tabular} % % And, after definition of an acronym like above: % % ~~\verb|\acroexpand{DIY}|~~$\longrightarrow$~~Do it yourself % % The macros \verb|\term| and \verb|\acro| simply set some text as term or % as acronym. \verb|\tacro| and \verb|\aterm| mark a term together with its % acronym or vice versa. In all cases, terms and acronyms are put into a % special index that can be used later. Layout can be controlled globally. % % \verb|\term| and \verb|\tacro| support an optional parameter for indexing. % With % % ~~\verb|\term[Potrzebie System of Weights and Measures]{Potrzebie System}| % % the term `Potrzebie System of Weights and Measures' is included in the index % but `\term[Potrzebie System of Weights and Measures]{Potrzebie System}` % is printed in the text. In the same way % % ~~\verb|\tacro[Gang of Four (Patterns)]{Gang of Four}{GoF}| % % prints `\tacro[Gang of Four (Patterns)]{Gang of Four}{GoF}` but indexes % `Gang of Four (Patterns)'. % % Each command has an emphasizing variant that starts with an uppercase letter: % % \begin{tabular}{lcl} % \verb|\Acro{SNAFU}| & $\longrightarrow$ & \Acro{SNAFU} \\ % \verb|\Term{Potrzebie}| & $\longrightarrow$ & \Term{Potrzebie} \\ % \verb|\Tacro{Do it yourself}{DIY}| & $\longrightarrow$ & \Tacro{Do it yourself}{DIY} \\ % \verb|\Aterm{DIY}{Do it yourself}| & $\longrightarrow$ & \Aterm{DIY}{Do it yourself} \\ % \end{tabular} % % \newpage % \section{Implementation} %\iffalse %<*package> %\fi % The current version of \pkg{\jobname} depends on \pkg{splitidx} for index % generation. This dependency may be removed in a future version. % % \begin{macrocode} \RequirePackage{splitidx}[2009/02/18 v1.1a] \RequirePackage{xifthen} % \end{macrocode} % % \subsection*{Styles} % % The following commands are used to simply print acronyms and terms. % They do not index but only format the arguments. You can redefine them % to change layout of acronyms and terms. The uppercase variant is used % for emphasizing. % % \begin{macro}{\acrostyle} % print an acronym in normal form % \begin{macro}{\Acrostyle} % print an acronym in emphasized form % \begin{macrocode} \newcommand{\Acrostyle}[1]{#1} \newcommand{\acrostyle}[1]{\textsc{\lowercase{#1}}} % \end{macrocode} % \end{macro} % \end{macro} % % \begin{macro}{\termstyle} % print a term in normal form % \begin{macro}{\Termstyle} % print a term in emphasized form % \begin{macrocode} \newcommand{\termstyle}[1]{#1} \newcommand{\Termstyle}[1]{\textit{#1}} % \end{macrocode} % \end{macro} % \end{macro} % % \begin{macro}{\tacrostyle} % print a term and its acronym in normal form % \begin{macro}{\Tacrostyle} % print a term and its acronym in emphasized form % \begin{macrocode} \newcommand{\tacrostyle}[2]{\termstyle{#1} (\acrostyle{#2})} \newcommand{\Tacrostyle}[2]{\Termstyle{#1} (\acrostyle{#2})} % \end{macrocode} % \end{macro} % \end{macro} % % \begin{macro}{\atermstyle} % print an acronym and its term in normal form % \begin{macro}{\Atermstyle} % print an acronym and its term in emphasized form % \begin{macrocode} \newcommand{\atermstyle}[2]{\acrostyle{#1} (\termstyle{#2})} \newcommand{\Atermstyle}[2]{\acrostyle{#1} (\termstyle{#2})} % \end{macrocode} % \end{macro} % \end{macro} % % \begin{macro}{\acroindexstyle} % print an acronym as index entry. % \begin{macrocode} \newcommand{\acroindexstyle}[1]{#1\acroexpand[ --- ]{#1}} % \end{macrocode} % \end{macro} % % \subsection*{Internal macros} % % \begin{macro}{\provideacronym} % Connects an acronym (that must only contain letters) with a term. % No output or index entry is generated. In most cases you do not % need to explicitly use this macro. % \begin{macrocode} \newcommand{\provideacronym}[2]{% TODO: detect redefinitions \expandafter\providecommand\expandafter{% \csname acronymlong#1\endcsname}{#2}% } % \end{macrocode} % \end{macro} % % \subsection*{Index generation} % % The following hack is required hack to mix hyperref and formatted page numbers. % It may be changed because \verb|\bfhref| may already have been defined. % \begin{macrocode} \newcommand{\bfhref}[1]{\textbf{\hyperpage{#1}}} % \end{macrocode} % % And some code for index generation (also to be fixed). % % \begin{macrocode} \newcommand{\acro@define}[2]{% #1: long term, #2: acronym \sindex[idx]{#1|see{\acrostyle{#2}}}% TODO: acronyms in general index? \@ifundefined{acronymlong#2}{% \provideacronym{#2}{#1}}{}% \sindex[acronym]{#2@\acroindexstyle{#2}|bfhref}% } % \end{macrocode} % \begin{macro}{\acroexpand} % print the expanded form (that is the term) of an acronym, if defined. % The optional first parameter is prepended only on success. % \begin{macrocode} \newcommand{\acroexpand}[2][]{% \@ifundefined{acronymlong#2}{}{% #1\csname acronymlong#2\endcsname}% } % \end{macrocode} % \end{macro} % % \subsection*{Main macros} % % \begin{macro}{\term} % marks a term in normal form. Parameters: \verb|[INDEX]{TERM}| % \begin{macrocode} \newcommand{\term}[2][]{% \ifthenelse{\isempty{#1}}% {\sindex[idx]{#2}}{\sindex[idx]{#1}}% \termstyle{#2}} % \end{macrocode} % \end{macro} % % \begin{macro}{\Term} % marks a term in emphasized form. Parameters: \verb|[INDEX]{TERM}| % \begin{macrocode} \newcommand\Term[2][]{% \ifthenelse{\isempty{#1}}% {\sindex[idx]{#2|bfhref}}% {\sindex[idx]{#1|bfhref}}% \Termstyle{#2}% } % \end{macrocode} % \end{macro} % % \begin{macro}{\acro} % marks an acronym in normal form. Parameters: \verb|{ACRO}| % \begin{macrocode} \newcommand{\acro}[1]{% \acrostyle{#1}% {\sindex[acronym]{#1@\acroindexstyle{#1}}}% } % \end{macrocode} % \end{macro} % % \begin{macro}{\Acro} % marks an acronym in emphasized form. Parameters: \verb|{ACRO}| % \begin{macrocode} \newcommand{\Acro}[1]{% \Acrostyle{#1}% {\sindex[acronym]{#1@\acroindexstyle{#1}}}% } % \end{macrocode} % \end{macro} % % \begin{macro}{\tacro} % Parameters: \verb|[INDEX]{TERM}{ACRO}| % \begin{macrocode} \newcommand{\tacro}[3][]{% \ifthenelse{\isempty{#1}}% {\acro@define{#2}{#3}}{\acro@define{#1}{#3}}% TODO: not define? \tacrostyle{#2}{#3}} % \end{macrocode} % \end{macro} % % \begin{macro}{\Tacro} % Parameters: \verb|[INDEX]{TERM}{ACRO}| % \begin{macrocode} \newcommand{\Tacro}[3][]{% \ifthenelse{\isempty{#1}}% {\acro@define{#2}{#3}}{\acro@define{#1}{#3}}% \Tacrostyle{#2}{#3}} % \end{macrocode} % \end{macro} % % \begin{macro}{\aterm} % Parameters: \verb|{ACRO}{TERM}| % \begin{macrocode} \newcommand{\aterm}[2]{% \acro@define{#2}{#1}% TODO: not define but only use? \atermstyle{#1}{#2}} % \end{macrocode} % \end{macro} % % \begin{macro}{\Aterm} % Parameters: \verb|{ACRO}{TERM}| % \begin{macrocode} \newcommand{\Aterm}[2]{% \acro@define{#2}{#1}% \Atermstyle{#1}{#2}} % \end{macrocode} % \end{macro} % % \subsection*{Bugs and missing features} % Index generation may need to be fixed. We also want to discover multiple % definitions of an acronom with different terms. Should terms, that % are used without acronym, occurr in the acronym index? Version 1.0 % sure needs to support other index generators. % % See the section on `Auxiliary macros for name indexing directives' % in biblatex source code for hints on including macros in the index. % % The latest development version of this package can be found at % \url{https://github.com/nichtich/acroterm}. % %\iffalse % %\fi % % \Finale % % \typeout{*************************************************************} % \typeout{*} % \typeout{* To finish the installation you have to move the following} % \typeout{* file into a directory searched by LaTeX:} % \typeout{*} % \typeout{* \space\space\space acroterm.sty} % \typeout{*} % \typeout{*************************************************************} % \endinput