summaryrefslogtreecommitdiff
path: root/macros/latex/contrib/polski/plprefix.dtx
diff options
context:
space:
mode:
authorNorbert Preining <norbert@preining.info>2019-09-02 13:46:59 +0900
committerNorbert Preining <norbert@preining.info>2019-09-02 13:46:59 +0900
commite0c6872cf40896c7be36b11dcc744620f10adf1d (patch)
tree60335e10d2f4354b0674ec22d7b53f0f8abee672 /macros/latex/contrib/polski/plprefix.dtx
Initial commit
Diffstat (limited to 'macros/latex/contrib/polski/plprefix.dtx')
-rw-r--r--macros/latex/contrib/polski/plprefix.dtx389
1 files changed, 389 insertions, 0 deletions
diff --git a/macros/latex/contrib/polski/plprefix.dtx b/macros/latex/contrib/polski/plprefix.dtx
new file mode 100644
index 0000000000..aeda373606
--- /dev/null
+++ b/macros/latex/contrib/polski/plprefix.dtx
@@ -0,0 +1,389 @@
+% \iffalse -*- doctex -*-
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+%% %%
+%% Package plprefix %%
+%% %%
+%% Purpose: to provide various variants of prefix notation for %%
+%% Polish diacritical characters. %%
+%% %%
+%% Copyright (c) by Marcin Woli\'nski <2003/01/09> %%
+%% wolinski@gust.org.pl %%
+%% %%
+%% %%
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+%% %%
+%% The package may be used freely, but you are not allowed to modify %%
+%% this file. If you wish to make any changes please make a copy %%
+%% under a different name. %%
+%% %%
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+% \fi
+%
+% \CheckSum{255}
+% \def\plpref{\textsf{plprefix}}
+% \def\popolsku{\textsc{polski}}
+%
+% \prefixing
+% \title{Prefiksowa notacja polskich znak/ow diakrytycznych.\\
+% Pakiet \plpref}
+% \author{Marcin Woli\'nski}
+% \date{9 stycz/nia 2003}
+% \maketitle
+%
+%
+% \section*{Wst/ep}
+% Notacja prefiksowa (,,ciachowa'') polega na zapisywaniu polskich
+% znak/ow diakrytycznych w~postaci dw/och znak/ow: \textit{prefiks}
+% oraz \textit{litera} (oba znaki o kodach $\leq127$). W~systemach,
+% w~kt/orych nie daje si/e w~spos/ob naturalny wy/swietla/c na ekranie
+% polskich znak/ow, taki zapis jest stosunkowo atrakcyjn/a alternatyw/a
+% dla stosowania standardowych makr \LaTeX a dla akcent/ow (|\'|, |\.|
+% i |\k|).
+%
+% Niestety w/sr/od polskich \TeX nik/ow nie ma zgodno/sci co do tego,
+% jaki znak powinien s/lu/zy/c jako prefiks. W czasach
+% prehistorycznych u/zywany bywa/l znak \texttt{@}, w /srodowiskach
+% zbli/zonych do Wydzia/lu Matematyki UW nadal popularna jest notacja
+% z czudzys/lowem (\texttt{"}), za/s od pojawienia si/e \MeX a na
+% popularno/sci zaczyna zyskiwa/c slash (,,ciach'' \texttt{//}). To
+% jednak nie koniec problemu, bowiem nie ma r/ownie/z zgodno/sci, jak
+% zapisywa/c litery /x i /z. Spotykane wersje to prefiks-x $\to$ /x i
+% prefiks-z $\to$ /z oraz prefiks-z $\to$ /x i prefiks-r $\to$ /z.
+%
+% Pakiet \plpref\ stanowi dodatek do pakietu \popolsku,
+% umo/zliwiaj/acy wyb/or u/zywanej notacji prefiksowej. Mnogo/s/c
+% pogl/ad/ow w kwestii notacji nale/zy jednak uzna/c za niekorzystn/a
+% i promowa/c jedn/a notacj/e (w/la/sciwym kandydatem wydaje si/e
+% notacja \MeX a). Inaczej m/owi/ac stosowanie pakietu \plpref\ nie
+% jest zalecane jako /ze ,,oficjaln/a'' notacj/e prefiksow/a
+% obs/luguje pakiet \popolsku. Pakiet \plpref\ zosta/l stworzony z
+% my/sl/a o umo/zliwieniu u/zytkowania \LaTeX a wszystkim
+% nieszcz/e/snikom, kt/orzy po prostu nie s/a w stanie patrze/c na
+% ciacha, marz/a za to o swojskim cudzys/lowie lub czym innym.
+%
+% \section{Instrukcja u/zytkownika}
+%
+% Pakiet \plpref\ /laduje si/e przy pomocy deklaracji |\usepackage|.
+% Aby dokona/c wyboru notacji nale/zy poda/c jako opcj/e zamierzony
+% spos/ob wprowadzania litery /z. Poni/zsza tabela przedstawia
+% dost/epne mo/zliwo/sci.
+%
+% \begin{center}
+% \nonprefixing
+% \begin{tabular}{ccccccccccl}
+% Opcja &\k a&\'c&\k e&\l&\'n&\'o&\'s&\'z&\.z\\
+% \tt/z &/a&/c&/e&/l&/n&/o&/s&/x&/z&domy\'slna, \MeX\\
+% \tt/r &/a&/c&/e&/l&/n&/o&/s&/z&/r\\
+% \tt"z &"a&"c&"e&"l&"n&"o&"s&"x&"z\\
+% \tt"r &"a&"c&"e&"l&"n&"o&"s&"z&"r\\
+% \tt@z &@a&@c&@e&@l&@n&@o&@s&@x&@z\\
+% \tt@r &@a&@c&@e&@l&@n&@o&@s&@z&@r
+% \end{tabular}
+% \end{center}
+%
+% Na przyk/lad nast/epuj/aca deklaracja zadaje notacj/e, w kt/orej
+% prefiksem jest znak \texttt{@}, liter/e /z zapisuje si/e jako
+% \texttt{@r}, natomiast /x jako \texttt{@z}:
+% \begin{verbatim}
+% \usepackage[@r]{plprefix}
+% \end{verbatim}
+%
+% W ka/zdym przypadku aby uzyska/c znak u/zywany jako prefiks nale/zy
+% napisa/c go dwa razy. W przyk/ladzie powy/zej aby uzyska/c
+% znak ,,at'' (@) piszemy \texttt{@@}.
+%
+% Ponadto aby pozosta/c w zgodno/sci z pakietem \popolsku\ w
+% wersji 1.01 zosta/ly dodane nast/epuj/ace kombinacje:
+% \mbox{\emph{prefix}-\texttt{,}} --- otwieraj/acy cudzys/l/ow polski,
+% \mbox{\emph{prefix}-\texttt{'}} --- zamykaj/acy cudzys/l/ow polski,
+% \mbox{\emph{prefix}-\texttt{<}} --- otwieraj/acy cudzys/l/ow francuski,
+% \mbox{\emph{prefix}-\texttt{>}} --- zamykaj/acy cudzys/l/ow francuski,
+% \mbox{\emph{prefix}-\texttt{-}} --- \verb+\dywiz+. Na przyk/lad przy
+% aktywnej deklaracji powy/zej nast/epuj/acy zapis jest poprawny:
+% \begin{verbatim}
+% Jan powiedzia@l: @,Marysia powiedzia@la: @<Wychyli@lam
+% puchar @r@o@lto@-zielonej @r@o@lci@>@'.
+% \end{verbatim}
+%
+% Pakiet w trakcie /ladowania nie uaktywnia notacji prefiksowej,
+% poniewa/z je/zeli po nim /ladowane s/a jakie/s inne pakiety mog/loby
+% to powodowa/c nieoczekiwane skutki. \DescribeMacro{\prefixing}%
+% /Zeby uaktywni/c notacj/e prefiksow/a nale/zy jawnie u/zy/c
+% polecenia |\prefixing|. Polecenie to jest zwyk/l/a lokaln/a
+% deklaracj/a. U/zyte wewn/atrz grupy obejmuje swoim zasi/egiem tekst do
+% ko/nca tej grupy. \DescribeMacro{\nonprefixing}Je/zeli
+% zachodzi potrzeba wy/l/aczenia prefiksowania nale/zy u/zy/c polecenia
+% |\nonprefixing|, kt/ore r/ownie/z jest deklaracj/a lokaln/a.
+%
+% Notacja prefiksowa nie podlega automatycznemu wy/l/aczeniu w obr/ebie
+% /srodowiska \texttt{verbatim}. Jest to r/o/znica w stosunku do \MeX a,
+% natomiast jest to zgodne z zachowaniem pakietu \popolsku. Zgodnie z
+% argumentacj/a Mariusza Olko, taki uk/lad daje mo/zliwo/s/c uzyskania
+% polskich znak/ow w obr/ebie /srodowiska \texttt{verbatim}, je/zeli za/s
+% nasz/a intencj/a jest efekt jak w \MeX u, wystarczy jawnie wy/l/aczy/c
+% prefiksowanie.
+%
+%
+% \begin{small}
+% \plpref\ pozwala na zastosowanie dowolnego znaku
+% jako prefiksu. \DescribeMacro{\SetPrefixChar}Mo/zna to osi/agn/a/c przy
+% pomocy deklaracji |\SetPrefixChar| podaj/ac jako argument znak, kt/ory
+% od tej pory ma s/luzy/c jako prefiks. Oto przyk/lad sytuacji w kt/orej
+% okaza/lo si/e to potrzebne (nieco egzotyczny ale prawdziwy): sk/ladamy
+% w j/ezyku polskim dokumentacj/e programu komputerowego, program jest
+% napisany z u/zyciem \texttt{CWEB}a. Znaki \texttt{//} i |"| maj/a
+% istotne znaczenie dla j/ezyka C i ich podwajanie og/lupi/loby
+% kompilator, natomiast |@| ma specjalne znaczenie dla
+% \texttt{CWEB}a. W tym przypadku zastosowano do zapisywania polskich
+% liter znak |`|, kt/ory szcz/e/sliwie nie by/l potrzebny do uzyskania
+% cudzys/low/ow, bo tekst by/l \emph{po polsku}.
+%
+% Druga interesuj/aca mo/zliwo/s/c to definiowanie nowych kombinacji
+% \emph{prefiks//litera}. \DescribeMacro{\Prefix} Osi/aga si/e to przy
+% pomocy makra |\Prefix|. Na przyk/lad nast/epuj/ace linie definiuj/a
+% kombinacj/e \emph{prefix}|<| (np. |//<| je/zeli prefiksem jest ciach)
+% jako lewy cudzys/l/ow francuski, \emph{prefix}|>| jako prawy cudzys/l/ow
+% francuski, natomiast \emph{prefix}|g| jako napis \texttt{g/lupi pomys/l?}.
+% \begin{verbatim}
+% \Prefix\let <\guillemotleft
+% \Prefix\let >\guillemotright
+% \Prefix\def g{g/lupi pomys/l?}
+% \end{verbatim}
+% Od tej pory zapis |Czy //<//zmir//lacz//> to //g| b/edzie znaczy/l
+% ,,Czy \guillemotleft /zmir/lacz\guillemotright\ to g/lupi pomys/l?''.
+% \end{small}
+%
+% \StopEventually{}
+% \iffalse
+%<*driver>
+ \documentclass{ltxdoc}
+%<driver>% You may need to add an option to select font encoding here:
+ \usepackage[MeX]{polski}
+%<driver>% Comment in next line if you don't want to print the code
+%<driver>% \OnlyDescription
+ \begin{document}
+ \DocInput{plprefix.dtx}
+ \end{document}
+%</driver>
+% \fi
+% \nonprefixing
+%
+% \language0
+%
+% \section{Source code}
+% \begin{macrocode}
+%<*package>
+\NeedsTeXFormat{LaTeX2e}[1996/06/01]
+\ProvidesPackage{plprefix}[2003/01/09 v1.02
+ Prefix notation for Polish characters]
+% \end{macrocode}
+% \begin{macro}{\ThePrefixChar}
+% Current prefix character of category 12 (other) will be saved in
+% macro |\ThePrefixChar|.
+% \begin{macrocode}
+\newcommand\ThePrefixChar{1}
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\prefixing}
+%
+% \begin{macrocode}
+\def\prefixing{\catcode\expandafter`\ThePrefixChar=\active
+ \bgroup \uccode`\~=\expandafter`\ThePrefixChar \uppercase{\egroup
+ \let~\PrefixMacro}%
+ }
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\nonprefixing}
+%
+% \begin{macrocode}
+\def\nonprefixing{\catcode\expandafter`\ThePrefixChar=12 }
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\SetPrefixChar}
+% Now we can define operator for selecting prefix character
+% \begin{macrocode}
+\newcommand\SetPrefixChar[1]{%
+ \nonprefixing
+ \bgroup \uccode`2=`#1\uppercase{\egroup
+ \def\ThePrefixChar{2}}%
+ \prefixing
+ }
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\PrefixMacro}
+% Here we define prefix notation handler. The first thing we do is
+% to check whether the prefix character is followed by an allowed
+% token. The first test is for second identical character (or
+% macro |\PrefixMacro|), in which case we just return a current
+% prefix character with category code |<other>|.
+%
+% We assume that for all allowed prefix-token combinations there
+% are defined macros named |\pref@<token>|. If comparison with
+% |\relax| is true the macro is not defined. We issue an error
+% message with some help.
+%
+% \begin{macrocode}
+\newcommand\PrefixMacro[1]{\ifx#1\PrefixMacro
+ \ifx\protect\@typeset@protect\else\protect\string\fi\ThePrefixChar
+ \else
+ \expandafter\ifx\csname pref@\string#1\endcsname\relax
+ \PrefixingError{#1}%
+ \else \csname pref@\string#1\endcsname \fi\fi
+ }
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\PrefixingError}
+% When a prefixing error is encountered we ignore the prefix but
+% leave the next token since in cases like |/\end| gobbling |/| is
+% just what is needed, but gobbling both would cause a disaster.
+% \begin{macrocode}
+\newcommand\PrefixingError[1]{%
+ \ifx\protect\@typeset@protect
+ \PackageError{plprefix}
+ {The prefix-character combination
+ \ThePrefixChar\noexpand#1 is undefined}%
+ {I will ignore the prefix character.}%
+ \else \expandafter\protect\ThePrefixChar \fi
+ \expandafter\expandafter\expandafter#1%
+ }
+% \end{macrocode}
+% \end{macro}
+%
+% Now we can set default prefix character (slash).
+% \begin{macrocode}
+\SetPrefixChar\/
+\nonprefixing
+% \end{macrocode}
+%
+% \begin{macro}{\Prefix}
+% To declare prefix-character combinations we use this auxiliary
+% macro. One says
+% \begin{verbatim}
+% \Prefix\def c{foo}
+% \end{verbatim}
+% to declare that prefix-|c| (eg. |/c|) should expand to
+% \texttt{foo}. This can be used as well with |\let|,
+% |\newcommand|, |\renewcommand|, |\ifx| etc.
+% \begin{macrocode}
+\newcommand\Prefix[2]{\expandafter#1\csname pref@#2\endcsname}
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\PlPrIeC}
+% This macro is needed to protect against removing white space in
+% TOC by Polish characters that have definition ending with a macro
+% call (|\l| and |\L|). The macro is identical to |\IeC| from
+% inputenc package, but we have to define it here not to depend on
+% inputenc. The name is different not to cause conflict in case
+% inputenc is loaded after plprefix.
+% \begin{macrocode}
+\def\PlPrIeC{%
+ \ifx\protect\@typeset@protect
+ \expandafter\@firstofone
+ \else
+ \noexpand\PlPrIeC
+ \fi
+}
+% \end{macrocode}
+% \end{macro}
+%
+% Next come the declarations of all Polish diacritics. Polish
+% characters are defined as normal accented letters, and we expect
+% that they will expand according to their definitions in the
+% current font encoding.
+%
+% Since \LaTeX\ redefines |\'| in |tabbing| environment, and prefix
+% notation should work also there, we don't use |\'| but a nickname
+% |\@acute| defined later on.
+% \begin{macrocode}
+\Prefix\def a{\k a} \Prefix\def A{\k A}
+\Prefix\def c{\@acute c} \Prefix\def C{\@acute C}
+\Prefix\def e{\k e} \Prefix\def E{\k E}
+\Prefix\def l{\PlPrIeC{\l}} \Prefix\def L{\PlPrIeC{\L}}
+\Prefix\def n{\@acute n} \Prefix\def N{\@acute N}
+\Prefix\def o{\@acute o} \Prefix\def O{\@acute O}
+\Prefix\def s{\@acute s} \Prefix\def S{\@acute S}
+\Prefix\def x{\@acute z} \Prefix\def X{\@acute Z}
+\Prefix\def z{\.z} \Prefix\def Z{\.Z}
+% \end{macrocode}
+% Some additional prefix combinations:
+% \begin{macrocode}
+\Prefix\def ,{\PlPrIeC{\quotedblbase}}
+\Prefix\def '{\PlPrIeC{\textquotedblright}}
+\Prefix\def <{\PlPrIeC{\guillemotleft}}
+\Prefix\def >{\PlPrIeC{\guillemotright}}
+\providecommand*\dywiz{%
+ \kern0sp\discretionary{-}{-}{-}\penalty10000\hskip0sp\relax}
+\Prefix\def -{\PlPrIeC{\dywiz}}
+% \end{macrocode}
+%
+% \begin{macro}{\prefZisZkropka}
+% \begin{macro}{\prefZisZkreska}
+% Two macros for toggling between notations using [prefix-|x| for
+% \'z and prefix-|z| for \.z] and [prefix-|z| for \'z and
+% prefix-|r| for \.z].
+% \begin{macrocode}
+\newcommand\prefZisZkropka{%
+ \Prefix\let r\relax \Prefix\let R\relax
+ \Prefix\def x{\@acute z}\Prefix\def X{\@acute Z}%
+ \Prefix\def z{\.z}\Prefix\def Z{\.Z}%
+ }
+\newcommand\prefZisZkreska{%
+ \Prefix\let x\relax \Prefix\let X\relax
+ \Prefix\def z{\@acute z}\Prefix\def Z{\@acute Z}%
+ \Prefix\def r{\.z}\Prefix\def R{\.Z}%
+ }
+% \end{macrocode}
+% \end{macro}
+% \end{macro}
+%
+% \subsection{Package options}
+% The options select requested notation for Polish characters.
+%
+% \begin{macrocode}
+\DeclareOption{/z}{\SetPrefixChar\/ \prefZisZkropka
+ \nonprefixing}
+\DeclareOption{"z}{\SetPrefixChar\" \prefZisZkropka
+ \nonprefixing}
+\DeclareOption{@z}{\SetPrefixChar\@ \prefZisZkropka
+ \catcode`\@=11}
+\DeclareOption{/r}{\SetPrefixChar\/ \prefZisZkreska
+ \nonprefixing}
+\DeclareOption{"r}{\SetPrefixChar\" \prefZisZkreska
+ \nonprefixing}
+\DeclareOption{@r}{\SetPrefixChar\@ \prefZisZkreska
+ \catcode`\@=11}
+% \end{macrocode}
+%
+% Font encoding current at begining of document can be assumed
+% default for document so we will define the nickname for |\'| then
+% (it will be slightly faster in this encoding).
+% \begin{macrocode}
+\ProcessOptions
+\AtBeginDocument{\let\@acute\'}
+%</package>
+% \end{macrocode}
+%
+% \Finale
+%
+% \endinput
+% \CharacterTable
+% {Upper-case \A\B\C\D\E\F\G\H\I\J\K\L\M\N\O\P\Q\R\S\T\U\V\W\X\Y\Z
+% Lower-case \a\b\c\d\e\f\g\h\i\j\k\l\m\n\o\p\q\r\s\t\u\v\w\x\y\z
+% Digits \0\1\2\3\4\5\6\7\8\9
+% Exclamation \! Double quote \" Hash (number) \#
+% Dollar \$ Percent \% Ampersand \&
+% Acute accent \' Left paren \( Right paren \)
+% Asterisk \* Plus \+ Comma \,
+% Minus \- Point \. Solidus \/
+% Colon \: Semicolon \; Less than \<
+% Equals \= Greater than \> Question mark \?
+% Commercial at \@ Left bracket \[ Backslash \\
+% Right bracket \] Circumflex \^ Underscore \_
+% Grave accent \` Left brace \{ Vertical bar \|
+% Right brace \} Tilde \~}