diff options
author | Karl Berry <karl@freefriends.org> | 2006-01-09 00:44:40 +0000 |
---|---|---|
committer | Karl Berry <karl@freefriends.org> | 2006-01-09 00:44:40 +0000 |
commit | b4fc5f639874db951177ec539299d20908adb654 (patch) | |
tree | 52f08823ca58fffe3db6a9b075635038c567626c /Master/texmf-dist/doc/latex/msg/msgtest.tex | |
parent | dec3d98ebe442d7ea93efbaa8dd2e2be8149a467 (diff) |
doc 4
git-svn-id: svn://tug.org/texlive/trunk@80 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/texmf-dist/doc/latex/msg/msgtest.tex')
-rw-r--r-- | Master/texmf-dist/doc/latex/msg/msgtest.tex | 199 |
1 files changed, 199 insertions, 0 deletions
diff --git a/Master/texmf-dist/doc/latex/msg/msgtest.tex b/Master/texmf-dist/doc/latex/msg/msgtest.tex new file mode 100644 index 00000000000..65f51bc1902 --- /dev/null +++ b/Master/texmf-dist/doc/latex/msg/msgtest.tex @@ -0,0 +1,199 @@ +% This is a second test file for the "msg" package; +% the first one being the msg.dtx file itself. +% +% You can replace "norsk" with your own language name to test +% a new messages file related to you language. +% +\documentclass[10pt]{article} + \usepackage[norsk,german,frenchb,english]{babel} + \usepackage[T1]{fontenc} + \usepackage{shortvrb} + \usepackage{msg}% +% \usepackage[tracefiles]{msg}% should also be tested with "tracefiles" +% \usepackage{msg,french}% should also be tested with your language. +\begin{document} +\MakeShortVerb{|} + +\title{The "msg" package test file} +\author{}\date{} +\maketitle + +The following examples are going from the ``msg'' documentation itself. + +\section*{Examples \& tests} + |\issuemsg1(msg)| will give at the console: \\ + \centerline{\tt\getmsg1(msg)} but + |\issuemsg01(msg)| will give: \retrievemsg01(msg){\tt\themsg}. + + While defining |\def\test#1{`\issuemsg4(msg)[#1]'}| the following call + |\emph{\test{SPECIAL}}| will print: \def\test#1{`\getmsg4(msg)[#1]'}\\ + \centerline{\emph{\test{SPECIAL}}} showing that the argument + was inserted inside the message at the exact area, replacing |#1|. + + In a French document, the same codes will issue:\\ + \bgroup\selectlanguage{french} + \centerline{\tt\getmsg1(msg)} + \centerline{\retrievemsg01(msg){\tt\themsg}} + \centerline{\emph{\test{SPECIAL}}} + \egroup + + \retrievemsg1(msg) + |\retrievemsg1(msg)| will set |\themsg| with the value of + the corresponding message ; nothing is issued at the console + nor in the log, except if the |<|\emph{id}|>| is not found in + the message file. + + \noindent|\show\themsg| will explain: + + \noindent|> \themsg=macro:| + + \noindent|->|\texttt{\themsg} + + \noindent In a French document, the same code will issue: + + \bgroup\selectlanguage{french} + \retrievemsg1(msg) + \noindent|> \themsg=macro:| + + \noindent|->|\texttt{\themsg} + \egroup + + In case the message file is empty or do not contain neither the message + ``id'' nor any |\msg{*}| macro then we will obtain: + \bgroup\makeatletter + \catcode`*=\active\let*\relax%^^A for expansion when \read case. + \let\@msg@code@ast=\active%^^A to simulate a missing \msg{*}. + \retrievemsg999(msg) + + \noindent|> \themsg=macro:| + + \noindent|->|\texttt{\themsg} + \egroup + + It may also arrive that we don't find that former message (|#6|) at all + then we will issue the usual \LaTeX\ |\PackageError| macro. + + We use message \# 5 of |msg-msg.tex| file as following: + + \noindent + \def\foo#1{\retrievemsg5(msg)[#1]\themsg\the\inputlineno\ \themsgi} + |\def\foo#1{\retrievemsg5(msg)[#1]\themsg\the\inputlineno\ \themsgi}| + + \medskip\noindent + then |\emph{The \foo{test}}| will generate: + + \centerline{The \emph{\foo{test}}} + + \noindent + In a French document, the code |\emph{La \foo{test}}| will issue: + + \bgroup\selectlanguage{french} + \centerline{\emph{La \foo{test}}} + \egroup + + \medskip + We will now use the message \# 8 of |msg-msg.tex| file in order + to show the customization set in that file. + + \medskip\noindent + |\getmsg8(msg)| will generate:\\ + \getmsg8(msg) + + The following |\texttt{\getmsg9(msg)}| using + |\MessageBreak| will give at the console:\\% + {\catcode`^^J=\active\let^^J\\%^^A We try to simulate the output console. + \def\@msgalspace{\hbox{\space}}%^^A In order to simule \obeyspaces + \def\space{\@sptoken}%^^A we used \space in \msgheader argument. + \def\MessageBreak{^^J\expandafter\@msgalign\msg@header\void% + \hbox{\space}}%^^A Please explain this tt behaviour... + \texttt{\getmsg9(msg)}\\% + } + (same message issued to the console\issuemsg9(msg)).%^^A Issue it really. + + \noindent + And in a French document, the same calls will issue:\\ + \bgroup\selectlanguage{french}% + \getmsg8(msg)\\% + \catcode`<=12\catcode`>=12\relax%^^A To remove ltxdoc active chars. + \catcode`^^J=\active\let^^J\\%^^A We try to simulate the output console. + \def\@msgalspace{\hbox{\space}}%^^A In order to simule \obeyspaces + \def\space{\@sptoken}%^^A We try to simulate the output console. + \def\MessageBreak{^^J\expandafter\@msgalign\msg@header\void% + \hbox{\space}}%^^A Please explain this tt behaviour... + \texttt{\getmsg9(msg)} + + \egroup + + Below is a test of an emphasized message (|\texttt{\getmsg{10}(msg)}|): + + {\catcode`^^J=\active\let^^J\\%^^A We try to simulate the output console. + \def\msg{\@ifstar{\def\@msgskip{\\}\@msg}{\def\@msgskip{}\@msg}}% + \def\@msgalspace{\hbox{\space}}%^^A In order to simule \obeyspaces + \def\space{\@sptoken}%^^A we used \space in \msgheader argument. + \def\MessageBreak{^^J\expandafter\@msgalign\msg@header\void% + \hbox{\space}}%^^A Please explain this tt behaviour... + \noindent\texttt{\getmsg{10}(msg)}% + } + (same message issued to the console\issuemsg{10}(msg)). + + Notice that the "msg" \emph{id} can be any string, not necessarily +a string of digits. Here is an expample : + +\begin{verbatim} +\newcommand{\ID}{12} +\texttt{\getmsg{\ID}(msg)} +\end{verbatim} + +\noindent +will generate the following: \\ +\newcommand{\ID}{12}\texttt{\getmsg{\ID}(msg)} + +\section*{Test the message encoding} + +Temporary we reset the input encoding to \texttt{ascii} by +calling |\inputencoding{ascci}| +\bgroup +\inputencoding{ascii} +and switch to Norsk +\selectlanguage{norsk}% +to typeset the message \# 12 (|\getmsg{12}(msg}|):\\ +``\getmsg{12}(msg)'' +\egroup + +\section*{Message list for all messages files} + +\long\def\testlanguagefile#1{% +{\selectlanguage{#1}% Don't forget to add it to \usepackage[...]{babel} +\parindent=0pt\tt +\textsf{Message list for the ``#1'' messages file:}\\[0.5\baselineskip] +\getmsg1(msg)\hfuzz\maxdimen\\ +\getmsg2(msg)\hfuzz\maxdimen\\ +\getmsg3(msg)\hfuzz\maxdimen\\ +\getmsg4(msg)\hfuzz\maxdimen\\ +\getmsg5(msg)\hfuzz\maxdimen\\ +\getmsg6(msg)\hfuzz\maxdimen\\ +\getmsg7(msg)\hfuzz\maxdimen\\ +\getmsg8(msg)\hfuzz\maxdimen\\ +\getmsg9(msg)\hfuzz\maxdimen\\ +\getmsg{10}(msg)\hfuzz\maxdimen\\ +\getmsg{11}(msg)\hfuzz\maxdimen\\ +\getmsg{12}(msg)\hfuzz\maxdimen\\ +\getmsg{*}(msg)\par\bigskip + +\typeout{Message list for the ``#1'' messages file^^J} +\issueallmsg(msg)% +}}% + +All messages for each language are now listed +in the document and on the console. + +\testlanguagefile{english} +\testlanguagefile{french} +\testlanguagefile{norsk} +\testlanguagefile{german} + +\section*{and now?} + +You could try it on any of your document class or package... +good testing. +\end{document} |