summaryrefslogtreecommitdiff
path: root/macros/latex/contrib/slantsc/slantsc.dtx
diff options
context:
space:
mode:
Diffstat (limited to 'macros/latex/contrib/slantsc/slantsc.dtx')
-rw-r--r--macros/latex/contrib/slantsc/slantsc.dtx482
1 files changed, 482 insertions, 0 deletions
diff --git a/macros/latex/contrib/slantsc/slantsc.dtx b/macros/latex/contrib/slantsc/slantsc.dtx
new file mode 100644
index 0000000000..fd7feb5deb
--- /dev/null
+++ b/macros/latex/contrib/slantsc/slantsc.dtx
@@ -0,0 +1,482 @@
+% \iffalse meta comment
+% File: slantsc.dtx Copyright (C) 2003, 2012 Harald Harders
+% \fi
+%
+% \iffalse
+%
+%<*driver>
+\documentclass{ltxdoc}
+\usepackage[T1]{fontenc}
+\IfFileExists{slantsc.sty}{\usepackage{slantsc}
+ \let\slantscSTYfound\active}{\GenericWarning{slantsc.dtx}{Package
+ file slantsc.sty not found (Documentation will be messed up!^^J^^A
+ Generate slantsc.sty by (La)TeXing slantsc.ins, process
+ slantsc.dtx again)^^J}\stop}
+\usepackage{longtable}
+\GetFileInfo{slantsc.sty}
+\title{The \texttt{slantsc} package}
+\author{Harald Harders\\\texttt{harald.harders@gmx.de}}
+\date{Version \fileversion, \filedate, printed \today}
+\newlength{\tempdima}%
+\makeatletter
+\renewenvironment{table}[1][]{%
+ \@float{table}[#1]%
+ \centering%
+ \setlength{\tempdima}{\abovecaptionskip}%
+ \setlength{\abovecaptionskip}{\belowcaptionskip}%
+ \setlength{\belowcaptionskip}{\tempdima}%
+ }{%
+\end@float
+}
+\makeatother
+\EnableCrossrefs
+\CodelineIndex
+\DoNotIndex{\def,\edef,\let,\newcommand,\newenvironment,\newcounter}
+\DoNotIndex{\setcounter,\space,\if,\else,\fi,\empty,\@empty,\ifx,\fi}
+\DoNotIndex{\ifnum,\fi,\expandafter,\DeclareRobustCommand,\ProvidesPackage}
+\DoNotIndex{\NeedsTeXFormat,\newif,\not@math@alphabet,\fontshape,\relax}
+\DoNotIndex{\selectfont}
+\CodelineNumbered
+\RecordChanges
+\CheckSum{146}
+\begin{document}
+ \DocInput{slantsc.dtx}
+\end{document}
+%</driver>
+% \fi
+%
+% \changes{2.11}{2012/01/01}{Update e-mail address}%
+% \changes{2.10}{2003/11/09}{State date and version explicitely in
+% \cs{ProvidesPackage}}%
+%
+% \maketitle
+% \begin{abstract}
+% \noindent
+% This package enables the use of small capitals in different font
+% shapes, e.g., slanted or bold slanted for all fonts that provide
+% appropriate font shapes.
+% The only prerequisite is that the corresponding |fd| file has to
+% define the font shapes |scsl| resp.\ |scit| for slanted resp.\
+% italic small capitals.
+% \end{abstract}
+%
+% \tableofcontents
+%
+% \section*{Copyright}
+% Copyright 2003, 2012 Harald Harders.
+%
+% This program can be redistributed and/or modified under the terms
+% of the LaTeX Project Public License Distributed from \textsc{ctan}
+% archives in directory macros/latex/base/lppl.txt; either
+% version 1 of the License, or any later version.
+%
+%
+% \section{The user interface}
+%
+% To use this package place
+% \begin{verbatim}
+% \usepackage{slantsc}
+% \end{verbatim}
+% in the preamble of your document. No options are necessary.
+%
+% In \LaTeX, you can combine different font parameters like a bold
+% series with an italic shape,
+% \begin{verbatim}
+% {\bfseries\itshape bold italic text}
+% \end{verbatim}
+% to get {\bfseries\itshape bold italic text}.
+% But you are not able to combine two font shapes.
+%
+% Since \emph{italic, slanted,} and \emph{small caps} are shapes, you
+% are not able write in {\slshape\scshape slanted small capitals}, for
+% instance.
+% This problem is avoided by the package |smallcap|, available from the
+% \textsc{ctan} network, which redefines small caps to be a font
+% family rather than a shape.
+% But what to do if your font provides small capitals in roman style
+% and in sans serifs?
+% You are not able to access the sans serif version, then.
+%
+% The |slantsc| package has a different approach.
+% It preserves small caps to be a font shape, but it enables to
+% combine the small caps shape with the other shapes (upright, italic,
+% slanted).
+% \DescribeMacro{\upshape}%
+% \DescribeMacro{\itshape}%
+% \DescribeMacro{\slshape}%
+% \DescribeMacro{\scshape}%
+% Thus, you use the normal font shape switching commands
+% \cs{upshape}, \cs{itshape}, \cs{slshape}, and \cs{scshape}.
+% The first three commands act as usual among themselves.
+% But if you use the \cs{scshape} command, it just adds the
+% information "`small capitals"' to the current font shape.
+%
+% For example, if the current font shape is italic and you use
+% \cs{scshape}, the following text is written in italic small
+% capitals:
+% \begin{verbatim}
+%\itshape This is italic text, \scshape now additionally in Small Capitals.
+% \end{verbatim}
+% This leads to:
+% \begin{quote}
+% \itshape This is italic text, \scshape now additionally in Small
+% Capitals.
+% \end{quote}
+% If you are in a small-capitals area, using one of the other font
+% switching commands does not affect the small capitals status, but
+% the rest of the font shape:
+% \begin{verbatim}
+%\itshape\scshape This is italic Small Capitals text, \upshape now Upright.
+% \end{verbatim}
+% This leads to:
+% \begin{quote}
+% \itshape\scshape This is italic Small Capitals text, \upshape now
+% Upright.
+% \end{quote}
+%
+% As usual, the change of font shape is terminated by the end of the
+% group, e.g., by using braces:
+% \begin{verbatim}
+%\itshape This is italic {\scshape with Small Capitals} and without.
+% \end{verbatim}
+% This leads to:
+% \begin{quote}
+% \itshape This is italic {\scshape with Small Capitals} and without.
+% \end{quote}
+% Sometimes, you may want to switch off small capitals without using a
+% group.
+% \DescribeMacro{\noscshape}%
+% To be able to do so, this package provides the \cs{noscshape}
+% command, which works as follows:
+% \begin{verbatim}
+%\itshape This is italic \scshape with Small Capitals \noscshape and without.
+% \end{verbatim}
+% This leads to:
+% \begin{quote}
+% \itshape This is italic \scshape with Small Capitals \noscshape and without.
+% \end{quote}
+%
+% \DescribeMacro{\textup}%
+% \DescribeMacro{\textit}%
+% \DescribeMacro{\textsl}%
+% \DescribeMacro{\textsc}%
+% \DescribeMacro{\emph}%
+% Instead of the font switching commands you may also use the
+% \cs{text}\ldots commands \cs{textup}, \cs{textit}, \cs{textsl},
+% \cs{textsc} as well as the \cs{emph} command, e.g.
+% \begin{verbatim}
+%This is \emph{the person \textsc{Harald Harders} who wrote} this
+%documentation.
+% \end{verbatim}
+% which leads to:
+% \begin{quote}
+% This is \emph{the person \textsc{Harald Harders} who wrote} this
+% documentation.
+% \end{quote}
+%
+% \DescribeMacro{\shapedefault}%
+% \changes{2.00}{2003/09/17}{Describe \cs{shapedefault} command}%
+% If you want another default font than the default, you may redefine
+% the \cs{shapedefault} command.
+% If you, for instance, want to use an italic small caps font as
+% default font, you may simply use
+% \begin{verbatim}
+% \renewcommand\shapedefault{\scdefault\itdefault}
+% \end{verbatim}
+% or
+% \begin{verbatim}
+% \renewcommand\shapedefault{\scitdefault}
+% \end{verbatim}
+% in the preamble of your document.
+% Both variants are equivalent.
+% Notice, that you have to use the command \cs{scdefault} before the
+% other command for combined font shapes.
+% If you want an upright small caps font as default, just use:
+% \begin{verbatim}
+% \renewcommand\shapedefault{\scdefault}
+% \end{verbatim}
+% You may not use \cs{scdefault}\cs{updefault} as argument!
+% To switch to the default font, you may use the \cs{defaultfont}
+% command.
+%
+% \DescribeMacro{\fontshape}%
+% \changes{2.00}{2003/09/17}{Describe \cs{fontshape} command}%
+% If you want to set the font shape directly, using the \cs{fontshape}
+% command, e.g.:
+% \begin{verbatim}
+% \fontshape{\scdefault\itdefault}\selectfont
+% \end{verbatim}
+% The argument of this command is used in the same way as for the
+% \cs{shapedefault} command.
+%
+%
+% \section{Using other fonts than European Modern}
+%
+% This package works with all fonts that provide slanted and italic
+% versions of the small capitals.\footnote{If bold versions are also
+% available, they are of course also supported.}
+% It is important that these font shapes are declared in a specific
+% way that |slantsc| can find them.
+%
+% |slantsc| uses two additional font shapes |scsl| and |scit|
+% which are slanted small caps and italic small caps,
+% respectively.\footnote{In this section, I assume that you haven't
+% redefined the default values for the different shapes. If you have
+% done so, you have do adobt all strings according to your changes.}
+% These font shapes have to be declared in the corresponding file with
+% the file name \meta{encoding}\meta{font family}|.fd|, e.g.,
+% |t1lmr.fd| for the Latin Modern fonts.
+% For instance, the Latin Modern font family (version 0.86) provides
+% slanted small capitals.
+% The corresponding entry in the |fd| file looks like this:
+% \begin{verbatim}
+%\DeclareFontShape{T1}{lmr}{m}{scsl}%
+% {<-> cork-lmcsco10}{}
+% \end{verbatim}
+% This command declares to use the font |cork-lmcsco10| for the
+% encoding |T1|, the font family |lmr|, the font series |m| (normal)
+% and the font shape |scsl| (slanted small caps).
+%
+% Unfortunately, Latin Modern does not contain the bold variant of the
+% slanted small caps.
+% But if it had it, the entry would look like that:
+% \begin{verbatim}
+%\DeclareFontShape{T1}{lmr}{bx}{scsl}%
+% {<-> ...}{}
+% \end{verbatim}
+%
+% Since nearly no font family will contain real italic small caps
+% variants, the best approach is to substitute them by slanted
+% variants.
+% This could be done for Latin Modern by the following commands:
+% \begin{verbatim}
+%\DeclareFontShape{T1}{lmr}{m}{scit}{<->ssub * lmr/m/scsl}{}
+%\DeclareFontShape{T1}{lmr}{bx}{scit}{<->ssub * lmr/bx/scsl}{}
+% \end{verbatim}
+%
+% With the OT1 encoded Computer Modern fonts, slanted small capitals
+% are not available, since these fonts do not contain them.
+% Nevertheless, the font encoding is not forced to T1 by this package
+% because it works with all encodings, if the font shapes are
+% present.
+%
+% \StopEventually{\PrintChanges \PrintIndex}
+%
+%
+% \section{The implementation}
+% \iffalse
+%<*package>
+% \fi
+% Heading of the package:
+% \begin{macrocode}
+\NeedsTeXFormat{LaTeX2e}
+\ProvidesPackage{slantsc}
+ [2012/01/01 v2.11 Provide Slanted an Italic Small Caps]
+% \end{macrocode}
+% More robust string comparisons.
+% \begin{macrocode}
+\RequirePackage{ifthen}
+% \end{macrocode}
+% Declare additional font shapes for European Computer Modern.
+% I think, this should normally go to |t1cmr.fd|, but it is never
+% read, since it is hardcoded to the format file.
+% \begin{macrocode}
+\DeclareFontFamily{T1}{cmr}{}
+\DeclareFontShape{T1}{cmr}{m}{scsl}%
+{<5><6><7><8><9><10><10.95><12><14.4>%
+ <17.28><20.74><24.88><29.86><35.83>genb*ecsc}{}
+\DeclareFontShape{T1}{cmr}{bx}{scsl}%
+{<5><6><7><8><9><10><10.95><12><14.4>%
+ <17.28><20.74><24.88><29.86><35.83>genb*ecoc}{}
+% \end{macrocode}
+% Since European Computer Modern does not have real italic Small Caps
+% substitute them silently by slanted ones.
+% \begin{macrocode}
+\DeclareFontShape{T1}{cmr}{m}{scit}{<->ssub * cmr/m/scsl}{}
+\DeclareFontShape{T1}{cmr}{bx}{scit}{<->ssub * cmr/bx/scsl}{}
+% \end{macrocode}
+% \begin{macro}{\scitdefault}
+% \changes{2.00}{2003/09/17}{Use commands for combined shapes}%
+% Default shortcut for italic small caps.
+% \begin{macrocode}
+\providecommand*\scitdefault{\scdefault\itdefault}
+% \end{macrocode}
+% \end{macro}
+% \begin{macro}{\scsldefault}
+% \changes{2.00}{2003/09/17}{Use commands for combined shapes}%
+% Default shortcut for slanted small caps.
+% \begin{macrocode}
+\providecommand*\scsldefault{\scdefault\sldefault}
+% \end{macrocode}
+% \end{macro}
+% \begin{macro}{\upshape}
+% \changes{2.00}{2003/09/17}{Avoid using booleans because that causes
+% problems with explicit use of \cs{fontshape}}%
+% Redefine the macro \cs{upshape} that switches to an upright font.
+% If small caps are ``on'', switch to ordinary small caps, otherwise
+% switch to the normal upright font.
+% \begin{macrocode}
+\DeclareRobustCommand\upshape{%
+ \not@math@alphabet\upshape\relax
+% \end{macrocode}
+% Font shape is with small caps.
+% \begin{macrocode}
+ \ifthenelse{\equal{\f@shape}{\scdefault}\or
+ \equal{\f@shape}{\scitdefault}\or\equal{\f@shape}{\scsldefault}}{%
+ \fontshape\scdefault
+ }{%
+% \end{macrocode}
+% Current font shape is without small caps or not known.
+% \begin{macrocode}
+ \fontshape\updefault
+ }%
+ \selectfont
+}
+% \end{macrocode}
+% \end{macro}
+% \begin{macro}{\slshape}
+% \changes{2.00}{2003/09/17}{Avoid using booleans because that causes
+% problems with explicit use of \cs{fontshape}}%
+% Redefine the macro \cs{slshape} that switches to a slanted font.
+% If small caps are ``on'', switch to slanted small caps, otherwise
+% switch to the normal slanted font.
+% \begin{macrocode}
+\DeclareRobustCommand\slshape{%
+ \not@math@alphabet\slshape\relax
+% \end{macrocode}
+% Font shape is with small caps.
+% \begin{macrocode}
+ \ifthenelse{\equal{\f@shape}{\scdefault}\or
+ \equal{\f@shape}{\scitdefault}\or\equal{\f@shape}{\scsldefault}}{%
+ \fontshape\scsldefault
+ }{%
+% \end{macrocode}
+% Current font shape is without small caps or not known.
+% \begin{macrocode}
+ \fontshape\sldefault
+ }%
+ \selectfont
+}
+% \end{macrocode}
+% \end{macro}
+% \begin{macro}{\itshape}
+% \changes{2.00}{2003/09/17}{Avoid using booleans because that causes
+% problems with explicit use of \cs{fontshape}}%
+% Redefine the macro \cs{itshape} that switches to an italic font.
+% If small caps are ``on'', switch to italic small caps, otherwise
+% switch to the normal italic font.
+% \begin{macrocode}
+\DeclareRobustCommand\itshape{%
+ \not@math@alphabet\itshape\relax
+% \end{macrocode}
+% Font shape is with small caps.
+% \begin{macrocode}
+ \ifthenelse{\equal{\f@shape}{\scdefault}\or
+ \equal{\f@shape}{\scitdefault}\or\equal{\f@shape}{\scsldefault}}{%
+ \fontshape\scitdefault
+ }{%
+% \end{macrocode}
+% Current font shape is without small caps or not known.
+% \begin{macrocode}
+ \fontshape\itdefault
+ }%
+ \selectfont
+}
+% \end{macrocode}
+% \end{macro}
+% \begin{macro}{\scshape}
+% \changes{2.00}{2003/09/17}{Avoid using booleans because that causes
+% problems with explicit use of \cs{fontshape}}%
+% Redefine the macro \cs{scshape} that switches to small capitals.
+% If the actual font is italic, switch to italic small caps, if it is
+% slanted, switch to slanted small caps, otherwise switch to ordinary
+% small caps.
+% \begin{macrocode}
+\DeclareRobustCommand\scshape{%
+ \not@math@alphabet\scshape\relax
+% \end{macrocode}
+% Font shape is with small caps.
+% Nothing to do.
+% \begin{macrocode}
+ \ifthenelse{\equal{\f@shape}{\scdefault}\or
+ \equal{\f@shape}{\scitdefault}\or\equal{\f@shape}{\scsldefault}}{%
+ }{%
+% \end{macrocode}
+% Current font shape is without small caps or not known.
+%
+% If current font is italic, switch to italic small caps.
+% \begin{macrocode}
+ \ifthenelse{\equal{\f@shape}{\itdefault}}{%
+ \fontshape\scitdefault
+ }{%
+% \end{macrocode}
+% If current font is slanted, switch to slanted small caps.
+% \begin{macrocode}
+ \ifthenelse{\equal{\f@shape}{\sldefault}}{%
+ \fontshape\scsldefault
+ }{%
+% \end{macrocode}
+% If current font is either upright or unknown, switch to upright
+% small caps.
+% \begin{macrocode}
+ \fontshape\scdefault
+ }%
+ }%
+ }%
+ \selectfont
+}
+% \end{macrocode}
+% \end{macro}
+% \begin{macro}{\noscshape}
+% \changes{2.00}{2003/09/17}{Avoid using booleans because that causes
+% problems with explicit use of \cs{fontshape}}%
+% Normally, using one of the font-shape commands \cs{upshape},
+% \cs{slshape}, \cs{itshape}, and \cs{scshape} switches from one font
+% shape to another, forgetting the old font shape.
+% The new approach is switches only between \cs{upshape},
+% \cs{slshape}, and \cs{itshape}.
+% \cs{scshape} is ``added'' to the other font shape information.
+% Thus, you are not able to use either of the commands \cs{upshape},
+% \cs{slshape}, and \cs{itshape} to switch off small caps again.
+% Therefor, you may use the command \cs{noscshape} which preserves the
+% used font shape but moves from small caps to ordinary characters.
+% \begin{macrocode}
+\DeclareRobustCommand\noscshape{%
+ \not@math@alphabet\noscshape\relax
+% \end{macrocode}
+% Font shape is with small caps.
+% \begin{macrocode}
+ \ifthenelse{\equal{\f@shape}{\scdefault}\or
+ \equal{\f@shape}{\scitdefault}\or\equal{\f@shape}{\scsldefault}}{%
+% \end{macrocode}
+% If current font is italic small caps, switch to italic.
+% \begin{macrocode}
+ \ifthenelse{\equal{\f@shape}{\scitdefault}}{%
+ \fontshape\itdefault
+ }{%
+% \end{macrocode}
+% If current font is slanted small caps, switch to slanted.
+% \begin{macrocode}
+ \ifthenelse{\equal{\f@shape}{\scsldefault}}{%
+ \fontshape\sldefault
+ }{%
+% \end{macrocode}
+% If current font is upright small caps, switch to upright.
+% \begin{macrocode}
+ \fontshape\updefault
+ }%
+ }%
+ }{%
+% \end{macrocode}
+% Current font shape is without small caps or not known.
+% Nothing to do.
+% \begin{macrocode}
+ }%
+ \selectfont
+}
+% \end{macrocode}
+% \end{macro}
+% \iffalse
+%</package>
+% \fi
+% \Finale