summaryrefslogtreecommitdiff
path: root/macros/generic/langcode
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/generic/langcode
Initial commit
Diffstat (limited to 'macros/generic/langcode')
-rw-r--r--macros/generic/langcode/README61
-rw-r--r--macros/generic/langcode/SrcFILEs.txt16
-rw-r--r--macros/generic/langcode/docsrc/langcode.tex80
-rw-r--r--macros/generic/langcode/docsrc/srcfiles.tex14
-rw-r--r--macros/generic/langcode/langcode.pdfbin0 -> 345459 bytes
-rw-r--r--macros/generic/langcode/langcode.sty141
6 files changed, 312 insertions, 0 deletions
diff --git a/macros/generic/langcode/README b/macros/generic/langcode/README
new file mode 100644
index 0000000000..ae5e0f51e5
--- /dev/null
+++ b/macros/generic/langcode/README
@@ -0,0 +1,61 @@
+
+ README for the `langcode' package
+
+ Adjust Language-Dependent Settings
+ by Language Code
+
+ (C) Uwe Lueck 2012/09/20
+
+
+`langcode.sty' in the first instance provides a command
+
+ \uselangcode{<chars>}
+
+to adjust language-dependent settings, such as key words,
+typographical conventions, and language codes (ISO-639-1).
+An author frequently writing documents in two or more languages
+can use the same commands independently of the language,
+provided they are gathered in a list macro to be used by the
+`dowith' package. If `\<cmd>' is in the list, it is set to work
+like `\<chars><cmd>', and a macro `\langcode' will expand to
+<chars> (the respective tokens), usable in URLs.
+
+The package is ``generic," based on `plainpkg'. The code has
+been used with `morehype' and `catchdq' (`catcodes'), but may
+be useful more generally.
+
+REQUIRED PACKAGES: plainpkg, stackrel, dowith
+
+RELATED PACKAGES: babel, polyglossia;
+ morehype, catchdq (catcodes)
+
+KEYWORDs: language support; German, macro programming
+ (programming structures), hypertext
+
+LICENSE:
+
+The package file `langcode.sty' and the documentation files
+`langcode.pdf' and `langcode.tex' 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, see
+
+ http://www.latex-project.org/lppl.txt
+
+We did our best to help you, but there is NO WARRANTY.
+
+The `langcode' package is author-maintained in the sense of
+this license.
+
+The latest public version of the package is available at
+
+ http://mirror.ctan.org/macros/generic/langcode/
+
+A TDS version of the package is available as
+
+ http://mirror.ctan.org/install/macros/generic/langcode.tds.zip
+
+Please report bugs, problems, and suggestions via
+
+ http://www.contact-ednotes.sty.de.vu
+
+
diff --git a/macros/generic/langcode/SrcFILEs.txt b/macros/generic/langcode/SrcFILEs.txt
new file mode 100644
index 0000000000..986d7d6b29
--- /dev/null
+++ b/macros/generic/langcode/SrcFILEs.txt
@@ -0,0 +1,16 @@
+
+ *File List*
+langcode.sty 2012/09/20 v0.2 language adjustment (UL)
+stacklet.sty 2012/08/27 v0.3 private letters (UL)
+langcode.tex 2012/09/20 -- documenting langcode.sty
+fifinddo.sty 2012/08/27 v0.6 filtering TeX(t) files by TeX (UL)
+ makedoc.sty 2012/08/28 v0.52 TeX input from *.sty (UL)
+niceverb.sty 2012/08/28 v0.5 minimize doc markup (UL)
+ makedoc.cfg 2012/07/13 -- documentation settings
+mdoccorr.cfg 2011/12/03 -- makedoc local typographical corrections
+srcfiles.tex 2012/09/20 -- file infos -> SrcFILEs.txt
+ ***********
+
+ List made at 2012/09/20, 13:25
+ from script file srcfiles.tex
+
diff --git a/macros/generic/langcode/docsrc/langcode.tex b/macros/generic/langcode/docsrc/langcode.tex
new file mode 100644
index 0000000000..fe7f417a3c
--- /dev/null
+++ b/macros/generic/langcode/docsrc/langcode.tex
@@ -0,0 +1,80 @@
+\ProvidesFile{langcode.tex}[2012/09/20 documenting langcode.sty]
+\title{\pkgtitle{langcode.sty}{%
+ Simple Language-Dependent Settings\\
+ Based on Language Codes}}
+{ \RequirePackage{makedoc} \ProcessLineMessage{}
+ \MakeJobDoc{17}%% 2011/11/23
+ {\SectionLevelThreeParseInput} } %% 2012/09/17
+\documentclass[fleqn]{article}
+% \usepackage{inputtrc} \dotracinginputs
+\input{makedoc.cfg} %% shared formatting settings
+% \ReadPackageInfos{langcode}
+% \usepackage{langcode,catchdq,ngerman} \originalTeX
+\usepackage{catchdq,langcode,ngerman} \originalTeX
+% \show\endqtd
+\MDkeywords{languages other than English; German, macro programming
+ (programming structures), hypertext}
+\sloppy
+% \listfiles
+\begin{document}
+\maketitle
+\begin{MDabstract}
+'langcode.sty' in the first instance provides a command
+$$|\uselangcode{<chars>}|$$ to adjust language-dependent settings,
+such as key words, typographical conventions, and language codes
+(\acro{\Wikiref{ISO-639-1}}).
+% it is intended to be a kind of ``leight-weight" \ctanpkgref{babel}.
+% It uses \ctanpkgref{dowith} for adjustments and
+% \ctanpkgref{plainpkg} for use with both \LaTeX\ and Plain \TeX.
+An author frequently writing documents in two or more languages
+can use the same commands independently of the language,
+provided they are gathered in a list macro to be
+used by the \ctanpkgref{dowith} package.
+If `\<cmd>' is in the list, it is set to work like
+`\<chars><cmd>', and a macro `\langcode' will expand to
+<chars> (the respective tokens), usable in \acro{URL}s.---The
+package is ``generic," based on \ctanpkgref{plainpkg}.
+The code has been used with \ctanpkgref{morehype} and
+'catchdq' (\ctanpkgref{catcodes}), but may be useful more generally.
+\MDaddtoabstract{Related packages} \ctanpkgref{babel}, \ctanpkgref{polyglossia}
+% \ctanpkgref{morehype}, 'catchdq' (\ctanpkgref{catcodes}),
+% \ctanpkgref{dowith}
+\end{MDabstract}
+\newpage
+\tableofcontents
+% \newpage
+% \section{Features and Usage}
+\section{Installing and Calling}
+The file 'langcode.sty' is provided ready, installation only requires
+putting it somewhere where \TeX\ finds it
+(which may need updating the filename data
+ base).\urlfoot{ukfaqref}{inst-wlcf} %% corr. 2011/02/08
+The packages \ctanpkgref{dowith}, \ctanpkgref{plainpkg},
+and 'stacklet' (\ctanpkgref{catcodes}) must be installed as well.
+
+As to calling (loading): 'langcode' is a ``\pkg{plainpkg} package"
+in the sense of the
+\ctanpkgref{plainpkg}\,\foothttpurlref{ctan.org/pkg/plainpkg}
+documentation that you may consult for details.
+So roughly,
+\begin{itemize}
+ \item load it by \ |\usepackage{langcode}| \ if you can,
+ \item otherwise by \ |\RequirePackage{langcode}| \\
+ (perhaps from within another ``\pkg{plainpkg} package"),
+ \item or by \ |\input langcode.sty|
+ \item or even by \ |\input{langcode.sty}|~\dots
+\end{itemize}
+
+% \pagebreak
+% \section{The Package File}
+\section{Header---\pkg{plainpkg} and Legalese}
+On the right hand side, that `plainpkg.tex' is loaded,
+before the package version is declared, for ``generic" function:
+\input{langcode.doc}
+
+\end{document}
+
+VERSION HISTORY
+
+2012/09/17 for v0.1 very first
+2012/09/20 extended ...
diff --git a/macros/generic/langcode/docsrc/srcfiles.tex b/macros/generic/langcode/docsrc/srcfiles.tex
new file mode 100644
index 0000000000..e90ac1459b
--- /dev/null
+++ b/macros/generic/langcode/docsrc/srcfiles.tex
@@ -0,0 +1,14 @@
+\ProvidesFile{srcfiles.tex}[2012/09/20 file infos -> SrcFILEs.txt]
+\RequirePackage{nicefilelist}
+\MFfieldtemplate{f-base}{langcode}
+\RequirePackage{myfilist}
+\EmptyFileList %%% [readprov.sty,myfilist.sty]
+%% packages:
+\ReadPackageInfos{langcode}
+%% documentation:
+\ReadFileInfos{langcode}
+%% documentation settings and auxiliaries: % % rm. 2012/09/20
+\ReadPackageInfos{fifinddo,makedoc,niceverb}
+\ReadFileInfos{makedoc.cfg,mdoccorr.cfg,srcfiles}
+\ListInfos[SrcFILEs.txt]
+
diff --git a/macros/generic/langcode/langcode.pdf b/macros/generic/langcode/langcode.pdf
new file mode 100644
index 0000000000..cff2d80a7e
--- /dev/null
+++ b/macros/generic/langcode/langcode.pdf
Binary files differ
diff --git a/macros/generic/langcode/langcode.sty b/macros/generic/langcode/langcode.sty
new file mode 100644
index 0000000000..e6206f9944
--- /dev/null
+++ b/macros/generic/langcode/langcode.sty
@@ -0,0 +1,141 @@
+ \input plainpkg
+\ProvidesPackage{langcode}[2012/09/20 v0.2 language adjustment (UL)]
+
+%% Copyright (C) 2012 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
+%%
+%% == Required ==
+%% 'langcode' is based on \ctanpkgref{dowith}:
+\RequirePackage{dowith}
+%%
+%% == General Commands ==
+%% |\uselangcode{<lcode>}| \ sets `\langcode' to <lcode>, runs
+%% `\langcodeadjust' on the items stored in `\langcodedependent',
+%% and finally executes what is stored in `\langcodeextras':
+\def\uselangcode#1{%
+ \def\langcode{#1}% %% 2012/01/07:
+ \DoWithAllIn\langcodeadjust\langcodedependent
+ \langcodeextras}
+%% |\langcodeadjust\<letters>| \ defines `\<letters>' to expand to
+%% `\<lcode><letters>':
+\def\langcodeadjust#1{%
+% \edef#1{\expandafter\noexpand
+% \csname\langcode
+ %% <- 2012/09/17 ->
+ \edef#1{\withcsname\noexpand \langcode
+ \expandafter\@gobble\string#1\endcsname}}
+%%
+%% == Sample Settings ==
+%% Such settings once should be in some \file{.cfg} file TODO
+%% === What Must Be Varied ===
+%% |\langcodedependent| \ is a list of commands that
+%% must be adjusted: %% ready 2012/09/20
+\def\langcodedependent{% %% 2012/01/07
+ \langcodeextras\dqtd\qtd\pardash\lastrev\totopofpage
+ \monthname} %% 2012/01/17
+%%
+%% === English vs. German ===
+%% ==== Months ====
+%% |\enmonthname{<num>}| yields the English name of the <num>th month
+%% of the year:
+\def\enmonthname#1{%
+ \ifcase #1\or
+ January\or February\or March\or April\or
+ May\or June\or July\or August\or
+ September\or October\or November\or December%
+ \fi}
+%% |\demonthname{<num>}| yields the \emph{German} name of the <num>th month
+%% month of the year:
+\def\demonthname#1{%
+ \ifcase #1\or
+ Januar\or Februar\or M\"arz\or April\or
+ Mai\or Juni\or Juli\or August\or
+ September\or Oktober\or November\or Dezember%
+ \fi}
+%% ==== Quotes ====
+%% For |\dqtd| settings, see (load) %% load 2012/09/20
+%% 'catchdq' (\ctanpkgref{catcodes} bundle).\footnote{% %% 2012/09/20
+%% The test below required loading 'catchdq' \emph{earlier}
+%% than 'langcode'.}
+%% % while |\qtd| settings are in 'blog.sty' (\ctanpkgref{morehype} bundle).
+%% |\enqtd{<en-text>}| and |\deqtd{<de-text>}|
+%% (overridable, e.g., with 'blog.sty'):
+\ifx\deqtd\undefined \def\deqtd#1{\glq#1\grq} \fi
+\ifx\enqtd\undefined \def\enqtd#1{`#1'} \fi
+%% You may get `\glq' and `\grq' from \CtanPkgRef{ngerman}{ngerman.sty}
+%% \[(`\usepackage{ngerman}\originalTeX'\]
+%% if needed. Here is a little
+%% \dqtd{tessst \qtd{inner}},
+%% due to the default |\uselangcode{en}|, we now issue |\uselangcode{de}|
+%% \let\delangcodeextras\empty
+%% \uselangcode{de}to get
+%% \dqtd{tessst \qtd{inner}}.
+%% ==== Dashes ====
+%% I introduced |\pardash| thinking of
+%% (German \dqtd{Gedankenstrich} and)
+%% long dashes as a weak version of a paragraph break.
+%% \uselangcode{en}
+%% A paragraph break somehow means moving from one thought
+%% to another\pardash almost the same what a long dash may
+%% mean.\pardash Here I have switched to \qtd{`en'}
+%% again, in order to get |\enpardash| by |\pardash|:
+\ifx\enpardash\undefined \let\enpardash\textemdash \fi
+%% \uselangcode{de}
+%% The \dqtd{Gedankenstrich} |\depardash| is not as long
+%% \uselangcode{en}
+%% as the \dqtd{thought dash}\uselangcode{de}\pardash er ist nur
+%% halb so lang\uselangcode{en}\pardash but it is surrounded
+%% by regular spaces:
+\ifx\depardash\undefined \def\depardash{ \textendash\space} \fi
+%% Some people prefer a so-called \dqtd{\Wikiref{hair space}}
+%% surrounding the long dash.
+%% ==== Wikipedia ====
+%% The previous Wikipedia link was obtained by |\Wikiref{hair space}|,
+%% working like |\Wikienref{hair space}|. This is an example of how
+%% \ctanpkgref{texlinks} makes use of |\uselangcode{<two-chars>}|.
+%% ==== 'blog.sty' ====
+%% In the present sample of \ |\langcodedependent|, \
+%% \[|\lastrev|\quad\mbox{and}\quad|\totopofpage|\] remain.
+%% I use them for \acro{HTML} with 'blog.sty'\pardash sorry,
+%% at present I cannot afford separating
+%% settings for a wider audience from my own ones.
+%%
+%% === Other Settings ===
+%% I haven't used English extras so far:
+\let\enlangcodeextras\empty %% \empty 2012/01/17
+%% With German, I have used the \ctanpkgref{dhua} package
+%% for certain abbrevations:
+\def\delangcodeextras{\RequirePackage{dhua}}
+%% However, this setting disables `\uselangcode{de}' after
+%% `\begin{document}'---which has not a problem with 'blog.sty',
+%% where I use it daily. For the tests above,
+%% I \emph{emptied} `\delangcodeextras'.
+%% I had not thought of changing the language \emph{within}
+%% one document before.
+%%
+%% == Default Language Code ==
+%% The default `\langcode' is \qtd{`en'} for English:
+\uselangcode{en}
+%% == Leaving the Package File ==
+\endinput
+%%
+%% == VERSION HISTORY ==
+
+v0.1 2012/01/07 in `texblog.fdf'
+ 2012/01/17
+v0.2 2012/09/17 own plainpkg package (\newcommand -> \def, ...)
+ 2012/09/20 doc. much expanded;
+ more blog-independent settings;
+ \Provides: v0.2, caption shortened (tld -> lc ->)