%% \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 \~} %\iffalse % % (c) copyright 1999 Apostolos Syropoulos % This software is derived from original software by the LaTeX3 Project. % This program can be redistributed and/or modified under the terms % of the LaTeX Project Public License Distributed from CTAN % archives in directory macros/latex/base/lppl.txt; either % version 1 of the License, or any later version. % % However, the above copyright notice does not apply in the case of % ``Crete University Press'' as this publisher is not allowed to % use or alter this file in any way. % % Please report errors or suggestions for improvement to % % Apostolos Syropoulos % 366, 28th October Str. % GR-671 00 Xanthi, GREECE % apostolo@ocean1.ee.duth.gr or apostolo@obelix.ee.duth.gr % %\fi % \CheckSum{145} % \iffalse This is a Metacomment % \begin{macrocode} %<*driver> \documentclass{ltxdoc} \GetFileInfo{grverb.drv} \begin{document} \DocInput{grverb.dtx} \end{document} % % \end{macrocode} % \fi % %\title{The `grverb' package} %\author{Apostolos Syropoulos\\366, 28th October Str.\\ %GR-671 00 Xanthi, HELLAS\\ %Email:\texttt{apostolo@obelix.ee.duth.gr}\\ or \\ %\hphantom{Email:}\texttt{apostolo@ocean1.ee.duth.gr}} % \date{1999/12/06} %\maketitle % %\MakeShortVerb{\|} %\StopEventually{} %\section{Introduction} % % One major drawback of the |greek| option of the babel package is that % one cannot easily write both Latin and Greek verbatim text. This is % particularly useful for computer listenings and, more generally, in computer % science related texts. This package solves this problem by introducing the % environment |grverbatim| and the command |grverb| whose functionality is % identical to the functionality of the corresponding standards. A public % domain font is used by both the command and the environment. The font % conforms to the ISO-8859-7 encoding for the Greek language.. % %\section{The code} % The first thing we do is to identify the package. % \begin{macrocode} %<*package> \NeedsTeXFormat{LaTeX2e}[1996/01/01] \ProvidesPackage{grverb}[1999/12/06\space v1.0] \typeout{Package: `grverb' v1.0\space <1999/12/06> (A. Syropoulos)} % \end{macrocode} % Since, we are going to use most characters with slot numbers above 127, we % need a macro to assign to a range of characters catcode 11 (letter). The % following macro is a modified version of macro |\inpenc@loop| which is % defined in the package inputenc. % %\begin{macro}{\@gr@inpenc@loop} % \begin{macrocode} \def\@gr@inpenc@loop#1#2{% \@tempcnta`#1\relax \loop \catcode\@tempcnta11 \ifnum\@tempcnta<`#2\relax \advance\@tempcnta\@ne \repeat} % \end{macrocode} %\end{macro} % The package uses the (public domain) font ``Greek-CourierPlain'' as the % default verbatim font. Since, this font is not known to the NFSS, we need % to write down the necessary definitions. We introduce a new family and % since the design size of the new verbatim font is slightly larger than % that of the cb fonts (i.e., the standart fonts used with the |greek| option % of the babel package), we need to shrink a little bit the character size % so that they match with the rest of the text. % % \begin{macrocode} \DeclareFontFamily{U}{grtt}{} \DeclareFontShape{U}{grtt}{m}{n}{ <-> s * [0.9] grcour8a}{} % \end{macrocode} % % We now define the new environment. The code is actually derived from % code which appears in the file |ltmiscen.dtx| in the standard \LaTeX2e % distribution. We define the new environment |grverbatim| which uses % the new verbatim font, instead of the standard one, and which assigns % to particular list of characters catcode 11. Note, that these changes % are local, so not to affect the behavior of \LaTeX. %\begin{macro}{\grverbatim} %\begin{macro}{\endgrverbatim} % \begin{macrocode} \begingroup \catcode `|=0 \catcode `[= 1 \catcode`]=2 \catcode `\{=12 \catcode `\}=12 \catcode`\\=12 |gdef|@grxverbatim#1\end{grverbatim}[#1|end[grverbatim]] |endgroup \def\@grverbatim{\trivlist \item\relax \if@minipage\else\vskip\parskip\fi \leftskip\@totalleftmargin\rightskip\z@skip \parindent\z@\parfillskip\@flushglue\parskip\z@skip \@@par \@tempswafalse \def\par{% \if@tempswa \leavevmode \null \@@par\penalty\interlinepenalty \else \@tempswatrue \ifhmode\@@par\penalty\interlinepenalty\fi \fi}% \let\do\@makeother \dospecials \obeylines \gr@verbatim@font \@noligs \everypar \expandafter{\the\everypar \unpenalty}% } \def\grverbatim{\begingroup\@gr@inpenc@loop\^^A\^^H% \@gr@inpenc@loop\^^K\^^K% \@gr@inpenc@loop\^^N\^^_% \@gr@inpenc@loop\^^?\^^ff% \@grverbatim \frenchspacing\@vobeyspaces \@grxverbatim} \def\endgrverbatim{\if@newlist \leavevmode\fi\endtrivlist\endgroup} % \end{macrocode} %\end{macro} %\end{macro} % We don't use the standard verbatim font, so we define a command to use % the new verbatim font. This allows us to use the usual verbatim commands % and environments without any problem. %\begin{macro}{\gr@verbatim@font} % \begin{macrocode} \def\gr@verbatim@font{\fontencoding{U}\fontfamily{grtt}\fontseries{m}% \selectfont} % \end{macrocode} %\end{macro} % The last thing we do is to define the new command |\grverb|. The command is % actually a modified version of the |\verb| command. The new thing is that % many non-letter characters become letters and we use the Greek verbatim % font instead of the standard one. %\begin{macro}{\grverb} % \begin{macrocode} \def\grverb{\relax\ifmmode\hbox\else\leavevmode\null\fi \bgroup \@gr@inpenc@loop\^^A\^^H% \@gr@inpenc@loop\^^K\^^K% \@gr@inpenc@loop\^^N\^^_% \@gr@inpenc@loop\^^?\^^ff% \verb@eol@error \let\do\@makeother \dospecials \gr@verbatim@font\@noligs \@verb} % % \end{macrocode} %\end{macro} % \section*{Acknowledgment} % I thank Antonios Tsolomitis for bringing to my attention this particular % problem and for testing the proposed solution. % \section*{Dedication} % I would like to dedicate this piece of work to my son % \begin{center}Demetrios-Georgios.\end{center} % \Finale % \endinput