diff options
author | Karl Berry <karl@freefriends.org> | 2011-09-17 22:58:34 +0000 |
---|---|---|
committer | Karl Berry <karl@freefriends.org> | 2011-09-17 22:58:34 +0000 |
commit | 1660ead686e1adf91f9eb96d0fe3010b137136f4 (patch) | |
tree | ab37eb5baa0187e16dc3b371f0e7ed1462237f5b /Master/texmf-dist/tex/latex/dhua | |
parent | 03fe8266f35acb30b86416f4c561943d568448f9 (diff) |
new german latex pkg dhua (17sep11)
git-svn-id: svn://tug.org/texlive/trunk@23992 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/texmf-dist/tex/latex/dhua')
-rw-r--r-- | Master/texmf-dist/tex/latex/dhua/dhua.cfg | 49 | ||||
-rw-r--r-- | Master/texmf-dist/tex/latex/dhua/dhua.sty | 217 |
2 files changed, 266 insertions, 0 deletions
diff --git a/Master/texmf-dist/tex/latex/dhua/dhua.cfg b/Master/texmf-dist/tex/latex/dhua/dhua.cfg new file mode 100644 index 00000000000..26b5c6ad037 --- /dev/null +++ b/Master/texmf-dist/tex/latex/dhua/dhua.cfg @@ -0,0 +1,49 @@ +\ProvidesFile{dhua.cfg}[2011/09/14 local settings for dhua] +%% +%% The user may want to use (some of) the following single macro +%% names for a different purpose or so; to this end, a file +%% `dhua.cfg' may contain a different set of definitions. +%% -- THIS HAS BEEN COPIED FROM `dhua.sty', +%% YOU MAY EDIT IT! +%% +%% |\idR| exemplifies multi-part abbreviations, +%% where \qtd{multi} means ``more than two": +\newdhua{\idR}{i\DhuaSpace d\DhuaSpace R} +% \show\idR +%% \begin{german} +%% |\idR| erzeugt \qtd{\idR} -- ein Anwendungsfall +%% f\"ur |\newdhua|. Nachfolgend wird nur noch +%% |\newtwopartdhua| verwendet. +%% \end{german} +%% +%% \LaTeX\ actually defines |\dh| as something nordic +%% (one of my earliest macro making experiences) +%% so we are \emph{re}defining it: +\PackageWarning{dhua}{Redefining \string\dh} +\let\dh\relax +\newtwopartdhua{\dh}{d}{h} +% \show\dh +%% \begin{german} +%% |\dh| wird hier \emph{umdefiniert}, um \qtd{\dh} zu bekommen. +%% Die \"ubrigen Makros sind \qtd{normale} Anwendungs\-f\"alle +%% von `\newtwopartdhua', man achte aber noch auf die +%% Verwendung von `\protect'. +%% \end{german} +%% +%% \dqtd{Normal} cases %% TODO catchdq +%% (|\oae| for \qtd{\oae}, |\uae| for \qtd{\uae}, +%% |\ua| for \qtd{\ua}, |\vglu| for \qtd{\vglu}, +%% |\vglo| for \qtd{\vglo}, |\qtd{\zB}| for \qtd{\zB}, +%% |\zT| for \qtd{\zT}): +\newtwopartdhua{\oae}{o}{\protect\"a} +% \newtwopartdhua{\oae{o}{\"a} +% \show\oae +%% ---exemplifying use of |\protect| so the definition of `\oae' +%% has a single token `\"', not an expansion of `\"': +\newtwopartdhua{\ua} {u}{a} +\newtwopartdhua{\uae} {u}{\protect\"a} +\newtwopartdhua{\vglu}{vgl}{u} +\newtwopartdhua{\vglo}{vgl}{o} +\newtwopartdhua{\zB} {z}{B} +\newtwopartdhua{\zT} {z}{T} +\endinput diff --git a/Master/texmf-dist/tex/latex/dhua/dhua.sty b/Master/texmf-dist/tex/latex/dhua/dhua.sty new file mode 100644 index 00000000000..7eede193dfb --- /dev/null +++ b/Master/texmf-dist/tex/latex/dhua/dhua.sty @@ -0,0 +1,217 @@ +\ProvidesPackage{dhua}[2011/09/16 v0.1a German phrase abbrevs (UL)] +%% copyright (C) 2011 Uwe Lueck, +%% http://www.contact-ednotes.sty.de.vu +%% -- author-maintained in the sense of LPPL below. +%% +%% This file can be redistributed and/or modified under +%% the terms of the LaTeX Project Public License; either +%% version 1.3c of the License, or any later version. +%% The latest version of this license is in +%% http://www.latex-project.org/lppl.txt +%% We did our best to help you, but there is NO WARRANTY. +%% +%% Please report bugs, problems, and suggestions via +%% +%% http://www.contact-ednotes.sty.de.vu +%% +%% \pagebreak +%% == Package Options == +%% \label{sec:opt} +%% === Idea === +%% You may say ``I can \[`\newcommand{\ua}{u.\,a.\xspace}'\] +%% myself." Yes, you can. The point of \[`\newtwopartdhua{\ua}{u}{a}'\] +%% is that you can use that same defining instruction for all of the +%% following \emph{types of documents:} \ (i)~\emph{requiring} |\xspace| +%% because in the source some `\ua' precedes a word without control space +%% (`\ ', as in `\ua weil'); \ (ii)~\emph{not} using `\xspace' +%% (I use it with \CtanPkgRef{morehype}{blog.sty} +%% where `\xspace' does not work); +%% \ (iii)~to be typeset for high-quality \emph{printing} +%% (thin space strongly recommended) +%% \ (iv)~to be displayed as \HTML\ +%% (\Wikienref{web typography} relevant, thin space somewhat dangerous). +%% \ +%% In order to use (almost) the \emph{same source} for (iii) and (iv), +%% the \LaTeX\ document preamble just must load the |[web]| option +%% for (iv) where it doesn't for (iii). +%% +%% === `web' === +%% \begin{german} +%% Paketoption |[web]| verwendet ein gesch\"utztes +%% Leerzeichen normaler Breite anstelle des empfohlenen +%% schmalen Festabstands. +%% \end{german} +%% In \wikienref{web typography}{web typography,} ` ' +%% (\Wikienref{no-break space}) may be used instead of a thin space +%% because some browsers do not support the latter +%% (the non-breakable one---which is not a \emph{named} \HTML\ +%% entity, it is U+202F---and some even the breakable one---which +%% is the named \HTML\ entity \verb+ +). +%% You can decide for this choice by package option |[web]|. +%% (Actually I use the package for direct \HTML\ generation +%% with 'blog.sty'.) +%% +%% === `xspace' === +%% With option |[xspace]|, the package's setup commands equip all the +%% single abbreviation macros with a final `\xspace' from the +%% \ctanpkgref{xspace} package in the \LaTeX\ \ctanpkgref{tools} bundle. +%% % (With 'blog.sty', `\xspace' does not work.) +%% \begin{german} +%% Mit der Paketoption `[xspace]' verwenden alle Abk\"urzungsmakros +%% automatisch (\mbox{--} sie enden auf \mbox{--}) `\xspace'. +%% \end{german} +%% +%% === Implementations === +%% |\dhuaspace| stores the dot plus the inner space +%% (TODO could be useful for Euro symbol without dot). +%% The default setting is: +\newcommand*\dhuaspace{.\,} +%% |\DhuaSpace| is for getting a single token in +%% \verb+\edef+s: +\newcommand*{\DhuaSpace}{\noexpand\dhuaspace} +%% Option |[web]| uses the tilde (tie, `~') instead of `\,': +\DeclareOption{web}{\newcommand*\dhuaspace{.~}} +%% I reasoned as follows for this: \ (i)~\emph{Either} the \HTML\ is +%% generated from \acro{DVI}, this is what +%% \CtanPkgRef{tex4ht}{TeX4ht} does. I don't know exactly, +%% but I assume that the combinatin of \pkg{TeX4ht} with a +%% \TeX\ run finally converts the tilde into ` '. +%% \ (ii)~\emph{Or} the \HTML\ generator translates the \TeX\ code +%% into \HTML\ in a more direct way. I don't know what all of these +%% programs actually do, but they ``should" translate `~' into +%% ` '. At least 'blog.sty' does, for sure. +%% +%% |\dhuaxspace| stores what closes the entire +%% abbreviation definition; by default it is a dot only. +%% Because German text should be typeset using +%% `\frenchspacing', we do not care about the space factor: +\newcommand*{\dhuaxspace}{.} +\@ifdefinable{\DhuaXspace}{\let\DhuaXspace\dhuaxspace} +\DeclareOption{xspace}{% + \AtEndOfPackage{\RequirePackage{xspace}}%% %% 2011/09/09 + \renewcommand*{\dhuaxspace}{.\xspace}% + \renewcommand*{\DhuaXspace}{\noexpand\dhuaxspace}} +%% ---That were all options, processed now: +\ProcessOptions +%% +%% == Setup Commands == +%% \label{sec:setup} +%% The syntax |\newdhua{<new-macro>}{<replace>}| is the same +%% as for \LaTeX's standard `\newcommand' etc. defining +%% user macros \emph{without parameters}. +%% However, `\newdhua' internally uses `\edef' in order to +%% minimize the number of tokens in the actual internal +%% replacement text. This additionally requires using +%% `\DhuaSpace' for separating the one-word abbreviations +%% in <replace>. +\newcommand*{\newdhua}[2]{\@ifdefinable#1{% +% \protected@edef#1{#2\DhuaXspace}% + \let\protect\noexpand %% 2011/09/04 +%% ... an unusual meaning of |\protect|, CARE! +%% I.e., `\protect' is used here to prevent expansion +%% in the setup macros. It is not stored for future expansion +%% with its usual robustification purpose. + \edef#1{#2\DhuaXspace}% + \let\protect\@typeset@protect +}} +%% \begin{german} +%% Um ein Makro <neu> f\"ur eine Abk\"urzung mit beliebig vielen +%% Gliedern zu definieren, trennt man die einzelnen Glieder +%% im <Ergebnis>-Argument der Definition +%% |\newdhua{<neu>}{<Ergebnis>}| +%% durch `\DhuaSpace' (Beispiel unten). +%% +%% \[|\newtwopartdhua{<neu>}{<B.-1>}{<B.-2>}|\] +%% definiert dasselbe Makro <neu> wie +%% \[`\newdhua{<neu>}{<B.-1>\DhuaSpace<B.-2>}'\] +%% \end{german} +%% +%% |\newtwopartdhua{<new>}{<letter-1>}{<letter-2>}| +%% results in the same macro <new> as +%% `\newdhua{<new>}{<letter-1>\DhuaSpace<letter-2>}': +\newcommand*{\newtwopartdhua}[3]{\newdhua#1{#2\DhuaSpace#3}} +%% +%% == Single Abbreviation Macros == +%% \label{sec:single} +%% The user may want to use +%% (some of) the following single macro names %% 2011/09/09 +%% for a different purpose or so; to this end, a file +%% `dhua.cfg' may contain a different set of definitions. +%% `\IfFileExists' works depending on whether a file +%% `dhua.cfg' is found: +\IfFileExists{dhua.cfg}{% + \typeout{^^J * single definitions read from \qtd{dhua.cfg} *^^J}% + \input{dhua.cfg}}{% +%% |\idR| exemplifies multi-part abbreviations, +%% where \qtd{multi} means ``more than two": + \newdhua{\idR}{i\DhuaSpace d\DhuaSpace R} +% \show\idR +%% \begin{german} +%% |\idR| erzeugt \qtd{\idR} -- ein Anwendungsfall +%% f\"ur |\newdhua|. Nachfolgend wird nur noch +%% |\newtwopartdhua| verwendet. +%% \end{german} +%% +%% \LaTeX\ actually defines |\dh| as something nordic +%% (one of my earliest macro making experiences) +%% so we are \emph{re}defining it: + \PackageWarning{dhua}{Redefining \string\dh} + \let\dh\relax + \newtwopartdhua{\dh}{d}{h} +% \show\dh +%% \begin{german} +%% |\dh| wird hier \emph{umdefiniert}, um \qtd{\dh} zu bekommen. +%% Die \"ubrigen Makros sind \qtd{normale} Anwendungs\-f\"alle +%% von `\newtwopartdhua', man achte aber noch auf die +%% Verwendung von `\protect'. +%% \end{german} +%% +%% \dqtd{Normal} cases %% TODO catchdq +%% (|\oae| for \qtd{\oae}, |\uae| for \qtd{\uae}, +%% |\ua| for \qtd{\ua}, |\vglu| for \qtd{\vglu}, +%% |\vglo| for \qtd{\vglo}, |\zB| for \qtd{\zB}, +%% |\zT| for \qtd{\zT}): + \newtwopartdhua{\oae}{o}{\protect\"a} +% \newtwopartdhua{\oae{o}{\"a} +% \show\oae +%% ---exemplifying use of |\protect| so the definition of `\oae' +%% has a single token `\"', not an expansion of `\"'. %%% : +%% %% <- doc. fix 2011/09/14 + \newtwopartdhua{\ua} {u}{a} + \newtwopartdhua{\uae} {u}{\protect\"a} + \newtwopartdhua{\vglu}{vgl}{u} + \newtwopartdhua{\vglo}{vgl}{o} + \newtwopartdhua{\zB} {z}{B} + \newtwopartdhua{\zT} {z}{T} +} %% Closes \IfFileExists +%% +%% == A Different Approach == +%% \begin{german} +%% Statt f\"ur +%% \qtd{\abkii AB} %%% `A.\,B.' +%% ein Makro zu definieren, +%% kann man auch \glqq`\abkii AB'\grqq\ tippen. +%% \end{german} +%% +%% I also thought that, instead of defining an abbreviation macro +%% (perhaps `\<letter-1><letter-2>'), +%% |\abkii <letter-1><letter-2>| %% add. space rm. {} 2011/09/10 +%% could be preferred to typing the +%% the two dots and `\,': +\@ifdefinable\abkii{% %% w/o `protected' 2011/09/09: + \edef\abkii#1#2{#1\DhuaSpace#2\DhuaXspace}} +% \show\abkii +%% So `\abkii AB' results in \qtd{\abkii AB}, saving you from +%% `A.\,B.'.---You may create +%% your own shorter alias <shal> for `\abkii' by `\let<shal>\abkii'. +%% Perhaps `\II': \let\II\abkii +%% `\let\II\abkii'---`\II AB'---\qtd{\II AB}. +%% Is this better than `A.\,B.'? +%% +%% == The End == +\endinput +%% +%% == VERSION HISTORY == +v0.1 2011/09/13 renamed `dhusw'->`dhua' +v0.1a 2011/09/14 doc. fix + 2011/09/16 doc. of options much extended |