summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/tex/latex/gmdoc/gmdocc.cls
diff options
context:
space:
mode:
authorKarl Berry <karl@freefriends.org>2007-12-25 19:55:32 +0000
committerKarl Berry <karl@freefriends.org>2007-12-25 19:55:32 +0000
commit57b6bdd7ce9155595f073c8e3c1a689a14f89e6a (patch)
tree37adee0138d0da146f5d11081b7197ff8f30079f /Master/texmf-dist/tex/latex/gmdoc/gmdocc.cls
parent49455a020514ef25d7ef902ed0a33348ac68cf1c (diff)
gmdoc update (19nov07)
git-svn-id: svn://tug.org/texlive/trunk@5905 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/texmf-dist/tex/latex/gmdoc/gmdocc.cls')
-rw-r--r--Master/texmf-dist/tex/latex/gmdoc/gmdocc.cls310
1 files changed, 234 insertions, 76 deletions
diff --git a/Master/texmf-dist/tex/latex/gmdoc/gmdocc.cls b/Master/texmf-dist/tex/latex/gmdoc/gmdocc.cls
index b224ba6173d..c1dd06eb6aa 100644
--- a/Master/texmf-dist/tex/latex/gmdoc/gmdocc.cls
+++ b/Master/texmf-dist/tex/latex/gmdoc/gmdocc.cls
@@ -6,10 +6,10 @@
%
% \begin{copyrnote}
%
-%%Written by Natror (Grzegorz Murzynowski),
-%% natror at o2 dot pl
+%% Written by Natror (Grzegorz Murzynowski),
+%% natror at o2 dot pl
%%
-%% \copyright\,2006 by Natror (Grzegorz Murzynowski).
+%% \copyright\,2006, 2007 by Natror (Grzegorz Murzynowski).
%%
%% This program is subject to the \LaTeX\ Project Public License.
%% See ^^A
@@ -30,11 +30,13 @@
% \chschange{v0.72}{06/11/14}{122}
% \chschange{v0.73}{06/12/1}{128}
% \chschange{v0.75}{2007/3/2}{130}
-%
+% \chschange{v0.76}{2007/11/13}{257}
+% \chschange{v0.77}{2007/11/16}{262}
+% \chschange{v0.78}{2007/11/19}{267}
\NeedsTeXFormat{LaTeX2e}
\ProvidesClass{gmdocc}
- [2007/03/02 v0.75 a class for gmdoc driver files (GM)]
+ [2007/11/19 v0.78 a class for gmdoc driver files (GM)]
%
% \division{Intro}
@@ -45,7 +47,7 @@
%% probably you may use another document class you like.
%%
%% By default this class loads \pk{mwart} class with a4paper (default)
-%% option and \pk{lmodern} package with QX fontencoding. It loads also
+%% option and \pk{lmodern} package with T1 fontencoding. It loads also
%% my \pk{gmdoc} documenting package which loads some auxiliary
%% packages of mine and the standard ones.
%%
@@ -59,7 +61,7 @@
%
% For the ideas and details of \pk{gmdoc}ing of the \LaTeXpar\ files
% see the \pk{gmdoc.sty} file's documentation (chapter \ref{gmd}). The
-% r\^ole of the \pk{gmdocc} document class is rather auxiliary and
+% r\ocircum le of the \pk{gmdocc} document class is rather auxiliary and
% exemplary. Most probably, you may use your favourite document class
% with the settings you wish. This class I~wrote to meet my needs of
% fine formatting, such as not numbered sections and sans serif demi
@@ -101,7 +103,7 @@
% \dekmedskip
%
% The default base document class loaded by \pk{gmdocc.cls} is Marcin
-% Woli\'nski's \pk{mwart}. If you have not installed it on your
+% Woli\nacute ski \pk{mwart}. If you have not installed it on your
% computer, the standard \pk{article} will be used.
%
% Moreover, if you like MW's classes (as I~do) and need |\chapter|
@@ -114,76 +116,148 @@
% The existence test is done for any MW class option as it is in the
% default case.
%
+% Since version 0.99g (November 2007) the bundle goes \XeTeX\ and that
+% means you can use the system fonts if you wish, just specify the
+% \TextUsage*{sysfonts} option and the three basic \XeTeX-related
+% packages (\pk{fontspec}, \pk{xunicode} and \pk{xltxtra}) will be
+% loaded and then you can specify fonts with the \pk{fontspec}
+% declarations. For use of them check the driver of this documentation
+% where the \TeX\ Gyre Pagella font is specified as the default Roman.
+%
% \stanza
-% The \TextUsage\EOFMark\ is in this class typesets like this (of
+% The \TextUsage\EOFMark\ in this class typesets like this (of
% course, you can redefine it as you wish):\par\EOFMark
%
% \StopEventually\NoEOF
%
% \division{The Code}
-% \CodeDefIndex\gmcc@baseclass
-\def\gmcc@baseclass{mwart}% the default is Marcin Woli\'nski's class (\pk{mwcls})
-% analogous to \pk{article}.
-
-% Since you can choose the standard \pk{article} class, we'd better
-% provide a~Boolean switch to keep the score of what was chosen. It's
-% to avoid unused options if \pk{article} is chosen.
-%\CodeDefIndex*{gmcc@mwcls}
+\RequirePackage{xkeyval}
+
+% A~shorthands for options processing (I~know \pk{xkeyval} to little
+% to redefine the default prefix and family).
+% \HideDefining\DeclareOptionX
+\newcommand*\gm@DOX{\DeclareOptionX[gmcc]<>}
+\newcommand*\gm@EOX{\ExecuteOptionsX[gmcc]<>}
+% \ResumeDefining\DeclareOptionX
+% \DeclareDefining*[prefix=\bslash gmcc@]\gm@DOX
+
+% We define the |class| option. I~prefer the \pk{mwcls}, but you can
+% choose anything else, then the standard \pk{article} is loaded.
+% Therefore we'd better provide a~Boolean switch to keep the score of
+% what was chosen. It's to avoid unused options if \pk{article} is
+% chosen.
\newif\ifgmcc@mwcls
-\gmcc@mwclstrue
-% \CodeDefine*{mwart}
-\DeclareOption{mwart}{\def\gmcc@baseclass{mwart}}% The \pk{mwart} class may also
+
+% Note that the following option defines |\gmcc@class#1|.
+\gm@DOX{class}{% the default will be Marcin Woli\nacute ski class
+ % (\pk{mwcls}) analogous to \pk{article}, see line \ref{EOXmwart}.
+ \def\gmcc@CLASS{#1}%
+ \@for\gmcc@resa:=mwart,mwrep,mwbk\do {%
+ \ifx\gmcc@CLASS\gmcc@resa\gmcc@mwclstrue\fi}%
+}
+
+
+
+\gm@DOX{mwart}{\gmcc@class{mwart}}% The \pk{mwart} class may also
% be declared explicitly.
-% \CodeDefine*{mwrep}
-\DeclareOption{mwrep}{\def\gmcc@baseclass{mwrep}}% If you need
-% chapters, this option chooses an MW's class that corresponds to
+
+\gm@DOX{mwrep}{\gmcc@class{mwrep}}% If you need
+% chapters, this option chooses an MW class that corresponds to
% \pk{report},
-% \CodeDefine*{mwbk}
-\DeclareOption{mwbk}{\def\gmcc@baseclass{mwbk}}% and this MW's class
+
+\gm@DOX{mwbk}{\gmcc@class{mwbk}}% and this MW class
% corresponds to \pk{book}.
-% \CodeDefine*{article}
-\DeclareOption{article}{\gmcc@mwclsfalse}% you can also
+
+\gm@DOX{article}{\gmcc@class{article}}% you can also
% \emph{choose} \pk{article}.
+% A~meta-remark: When I~tried to do the most natural thing, to
+% |\ExecuteOptionsX| inside such declared option, an error occured:
+% 'undefined control sequence \inverb|\XKV@resa -> \@nil|'.
-% \CodeDefine*{outeroff}
-\DeclareOption{outeroff}{\let\outer\relax}% This option allows
+
+\gm@DOX{outeroff}{\let\outer\relax}% This option allows
% |\outer|-prefixed macros to be \pk{gmdoc}-processed with all the
% bells and whistles.
-% \CodeDefine\if@debug
\newif\if@debug
-% \CodeDefine*{debug}
-\DeclareOption{debug}{\@debugtrue}% This option causes \pk{trace} to
+
+\gm@DOX{debug}{\@debugtrue}% This option causes \pk{trace} to
% be loaded and the Boolean switch of this option may be used to hide
% some things needed only while debugging.
-% \CodeDefine*{noindex}
-\DeclareOption{noindex}{%
- \PassOptionsToPackage{\CurrentOption}{gmdoc}}% This
+
+\gm@DOX{noindex}{%
+ \PassOptionsToPackage{noindex}{gmdoc}}% This
% option turns the writing outto \file{.idx} file off.
-% \CodeDefIndex\if@gmccnochanges
-% \CodeDefIndex*\@gmccnochangestrue
-% \CodeDefIndex*\@gmccnochangesfalse
+
\newif\if@gmccnochanges
-% \CodeDefine*{nochanges}
-\DeclareOption{nochanges}{\@gmccnochangestrue}% This option turns the
+
+\gm@DOX{nochanges}{\@gmccnochangestrue}% This option turns the
% writing outto \file{.glo} file off.
-% \CodeDefine*{gmeometric}
-\def\gmTheGeometry{geometry}
-\DeclareOption{gmeometric}{%
- \IfFileExists{gmeometric.sty}{%
- \def\gmTheGeometry{gmeometric}}{}}% It's an experimental option
-% that causes the |\geometry| macro provided by \pk{geometry} package
-% is not restricted to the preamble. This option causes the
-% \pk{gmeometric} package is loaded (if available) that works the
-% limitation around.
+\gm@DOX{gmeometric}{}% The \pk{gmeometric} package
+% causes the |\geometry| macro provided by \pk{geometry} package
+% is not restricted to the preamble.
+%
+% Since version 0.99g of \pk{gmdoc} the bundle goes \XeTeX\ and that
+% means \pk{geometry} should be loaded with |dvipdfm| option and the
+% |\pdfoutput| counter has to be declared and that's what
+% \pk{gmeometric} does by default if with \XeTeX. And \pk{gmeometric}
+% has passed enough practical test. Therefore the |gmeometric| option
+% becomes obsolete and the package is loaded always instead of
+% original \pk{geometry}.
+%
+% \stanza As already mentioned, since version
+% 0.99g the \pk{gmdoc} bundle goes \XeTeX. That means that if \XeTeX\
+% is detected, we may load the \pk{fontspec} package and the other two
+% of basic three \XeTeX-related, and then we |\fontspec| the fonts.
+% But the default remains the old way and the new way is given as the
+% option below.
+
+\newif\ifgmcc@oldfonts
+\gmcc@oldfontstrue
+\gm@DOX{sysfonts}{\gmcc@oldfontsfalse}
+
+% Now we define a~key-val option that sets the version of marginpar
+% typewriter font definition (relevant only with the |sysfonts|
+% option). 0 for OpenType LMTT LC visible for the system (not on my
+% computer), 1 for LMTT LC specially on my computer, any else number to avoid an
+% error if you don't have OpenType LMTT LC installed (and leave the
+% default \pk{gmdoc}'s definition of |\marginpartt|; all the versions
+% allow the user to define marginpar typewriter \himher self).
+\gm@DOX{mptt}[17]{\def\mpttversion{#1}}% the default value (17) works if
+% the user puts the |mptt| option with no value. In that case leaving
+% the default \pk{gmdoc}'s definition of marginpar typewriter and
+% letting the user to redefine it \himher self seemed to me most natural.
+
+\def\gmcc@setfont#1{%
+ \gmcc@oldfontsfalse% note that if we are not in \XeTeX, this switch
+ % will be turned true in line \ref{ofstrue}
+ \AtBeginDocument{%
+ \@ifXeTeX{%
+ % ^^A \def\f@encoding{U}\selectfont
+ \setromanfont[Mapping=tex-text]{#1}%
+ \let\sl\it \let\textsl\textit
+ }{}}%
+}
+
+\gm@DOX{minion}{\gmcc@setfont{Minion Pro}}
+\gm@DOX{pagella}{\gmcc@setfont{TeX Gyre Pagella}}
+
+
+
+\gm@EOX{class=mwart}% \label{EOXmwart}We set the default basic class to
+% be \pk{mwart}.
+
+\gm@EOX{mptt=0}% We default to set the marginpar typewriter font to
+% OpenType LMTT LC.
+
+\ProcessOptionsX[gmcc]<>
-\ProcessOptions
% \newif\ifSecondClass^^A~to assure \TeX knows ifSecondClass
% ^^A switch and therefore it counts the fis properly.
@@ -197,42 +271,93 @@
\ifSecondClass\else
%\fi\fi
\ifgmcc@mwcls
- \IfFileExists{\gmcc@baseclass.cls}{}{\gmcc@mwclsfalse}% As
+ \IfFileExists{\gmcc@CLASS.cls}{}{\gmcc@mwclsfalse}% As
% announced, we do the ontological test to any \pk{mwcls}.
\fi
\ifgmcc@mwcls
+ \XKV@ifundefined{XeTeXdefaultencoding}{}{%
+ \XeTeXdefaultencoding "cp1250"}% \pk{mwcls} are encoding-sensitive
+ % because MW uses Polish diacritics in the commentaries.
\LoadClass[fleqn, oneside, noindentfirst, 11pt, withmarginpar,
- sfheadings]{\gmcc@baseclass}%
+ sfheadings]{\gmcc@CLASS}%
+ \XKV@ifundefined{XeTeXdefaultencoding}{}{%
+ \XeTeXdefaultencoding "utf-8"}%
\else
\LoadClass[fleqn, 11pt]{article}% Otherwise the standard \pk{article} is
% loaded.
\fi
+% \iffalse\iffalse
+\fi
+% of ifSecondClass'es \cs{else} (a~feature under construction).\fi
+
+\RequirePackage{gmutils}% earlier to provide |\@ifXeTeX|.
+
+\ifgmcc@mwcls\afterfi\ParanoidPostsec\fi
+
+\@ifXeTeX{}{\gmcc@oldfontstrue}
+% \label{ofstrue}
\AtBeginDocument{\mathindent=\CodeIndent}
-% The |fleqn| option makes displayed formuals be flushed left and
+% The |fleqn| option makes displayed formul\ae\ be flushed left and
% |\mathindent| is their indentation. Therefore we ensure it is always
% equal |\CodeIndent| just like |\leftskip| in \env{verbatim}. Thanks
% to that and the |\edverbs| declaration below you may display single
% verbatim lines with |\[...\]|:
% \[\verb+\[|\verbatim\stuff|\]+\,.\]
-\IfFileExists{lmodern.sty}{% We also examine the ontological status of
- % this package
- \RequirePackage{lmodern}% and if it shows to be satisfactory (the
- % package shows \emph{to be}), we load it and set the proper
- % font encoding.
- \RequirePackage[QX]{fontenc}%
-}{}
-%\iffalse\iffalse
+\ifgmcc@oldfonts
+ \IfFileExists{lmodern.sty}{% We also examine the ontological status of
+ % this package
+ \RequirePackage{lmodern}% and if it shows to be satisfactory (the
+ % package shows \emph{to be}), we load it and set the proper
+ % font encoding.
+ \RequirePackage[T1]{fontenc}%
+ }{}%
+% A~couple of diacritics I~met while \pk{gmdocing} these files and The
+% Source etc. Somewhy the accents didn't want to work at my \XeTeX\
+% settings so below I~define them for \XeTeX\ as respective chars.
+ \def\agrave {\`a}%
+ \def\cacute {\'c}%
+ \def\eacute {\'e}%
+ \def\idiaeres{\"\i}%
+ \def\nacute {\'n}%
+ \def\ocircum {\^o}%
+ \def\oumlaut {\"o}%
+ \def\uumlaut {\"u}%
+\else% this case hapens only with \XeTeX.
+ \let\do\relaxen
+ \do\Finv\do\Game\do\beth\do\gimel\do\daleth% these five caused the
+ % `already defined' error.
+ \XeTeXthree
+ %^^A \setromanfont{LMRoman12}% Regular
+%^^A \setsansfont{LMSans10}% Regular
+%^^A \setmonofont{LMTypewriter10}% Regular
+ \let\fontencoding\@gobble
+ \def\agrave {\char"00E0 }%
+ \def\cacute {\char"0107 }% Note the space to be sure the number
+ % ends here.
+ \def\eacute {\char"00E9 }%
+ \def\idiaeres{\char"00EF }%
+ \def\nacute {\char"0144 }%
+ \def\oumlaut {\char"00F6 }%
+ \def\uumlaut {\char"00FC }%
+ \def\ocircum {\char"00F4 }%
+ \AtBeginDocument{%
+ \def\ae{\char"00E6 }%
+ \def\l {\char"0142 }%
+ \def\oe{\char"0153 }%
+ }%
\fi
-% of ifSecondClass (a~feature under construction).\fi
-
-\RequirePackage[margin=2.7cm, left=4cm,
- right=2.2cm]{\gmTheGeometry}% Now we set the
-% page layout.
+% Now we set the page layout.
+\RequirePackage{gmeometric}
\def\gmdoccMargins{%
- \geometry{margin=2.7cm, left=4cm, right=2.2cm}}
+ \geometry{top=77pt, height=687pt, % =53 lines but the |lines| option
+ % seems not to work 2007/11/15 with \TeX\ Live 2007 and \XeTeX\
+ % 0.996-patch1
+ left=4cm, right=2.2cm}}
+\gmdoccMargins
+
\if@debug% For debugging we load also the \pk{trace} package that was
% very helpful to me.
@@ -240,18 +365,38 @@
\errorcontextlines=100 % And we set an error info parameter.
\fi
-%\CodeDefine\ifdtraceon
-%\CodeDefine\ifdtraceoff
\newcommand*\ifdtraceon{\if@debug\afterfi\traceon\fi}
\newcommand*\ifdtraceoff{\if@debug\traceoff\fi}
% We load the core package:
\RequirePackage{gmdoc}
-\@ifpackageloaded{lmodern}{% The Latin Modern font family provides
- % a~light condensed typewriter font that seems to be the most
- % suitable for the marginpar CS marking.
- \def\marginpartt{\normalfont\fontseries{lc}\ttfamily}}%
+\ifgmcc@oldfonts
+ \@ifpackageloaded{lmodern}{% The Latin Modern font family provides
+ % a~light condensed typewriter font that seems to be the most
+ % suitable for the marginpar CS marking.
+ \def\marginpartt{\normalfont\fontseries{lc}\ttfamily}}{}%
+\else
+ \IfFileExists{/media/BleuDeParis/texmf/tex/xelatex/crop.cfg}%
+ {\def\mpttversion{1}}{}% my system doesn't see LMTT LC, so on my
+ % computer I~have to tell \XeTeX explicitly where the font is.
+ \ifcase\mpttversion
+ \font\marginpartt= lmtypewriter10-lightcondensed.otf at 10.95pt
+ \or% (when =1, on my computer that is)
+ \font\marginpartt= %
+ [/home/natror/.fonts/lmtypewriter10-lightcondensed.otf] at 10.95pt
+ \else % other values allow you to define |\marginpartt| yourself.
+ \fi
+%^^A~ \iffontchar \marginpartt 32 \show\relax \else \show\par\fi
+%^^A~
+%^^A~ LMTypewriter10-LightCondensed.pfb at 10.95pt
+%^^A~ "LMTypewriter10:style=LightCondensed"
+%^^A~ "LMTypewriter10 LightCond,LMTypewriter10\bslash-LightCond:style=Regular"
+%^^A~ "LMTypewriter10:style=LightCondensed"
+%^^A~ Garamond
+%^^A~ LMTypewriter10-Light.pfb
+%^^A~ /home/natror/.fonts/lmtypewriter10-lightcondensed.otf
+\fi
% ^^A\setcounter{IndexColumns}{2} narrow columns do spare space and
@@ -298,13 +443,26 @@
\def\EOFMark{\rightline{\ensuremath{\square}}}
+
\endinput
% \changes{v0.677}{06/9/23}{Added checkings if \pk{mwart.cls} and
-% \pk{lmodern.sty} are available and more standard behaviour if they
-% are not}
+% \pk{lmodern.sty} are available and more standard behaviour if they
+% are not}
%
% \changes{v0.70}{06/10/10}{Added some options and Latin Modern Light
-% Condensed to the marginpar CSs.}
+% Condensed to the marginpar CSs.}
+%
+% \changes{v0.76}{2007/10/30}{The \cs[]{gmeometric} option made
+% obsolete and the \pk{gmeometric} package is loaded always, for
+% \XeTeX-compatibility. And the class options go \pk{xkeyval}.}
+%
+% \changes{v0.77}{2007/11/16}{Bug fix of sectioning commands in
+% \pk{mwcls} and the default font encoding for \TeX ing old way
+% changed from \acro{QX} to \acro{T1} because of the `corrupted
+% \acro{NTFS} tables' error}
+%
+% \changes{v0.78}{2007/11/19}{Added the \env{pagella} option not to
+% use Adobe Minion Pro that is not freely licensed}
%
% \Finale