You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
143 lines
4.1 KiB
TeX
143 lines
4.1 KiB
TeX
% \iffalse meta-comment
|
|
%
|
|
% File: ifprintedition.dtx
|
|
% Version: 2023/07/12 v0.1
|
|
% Info: Detect class options printedition and webedition
|
|
%
|
|
% Copyright (C) 2023 by Taha Ahmed
|
|
% https://git.solarchemist.se/taha/ifprintedition
|
|
%
|
|
% This work may be distributed and/or modified under the
|
|
% conditions of the LaTeX Project Public License, either
|
|
% version 1.3c of this license or (at your option) any later
|
|
% version. This version of this license is in
|
|
% https://www.latex-project.org/lppl/lppl-1-3c.txt
|
|
% and the latest version of this license is in
|
|
% https://www.latex-project.org/lppl.txt
|
|
% and version 1.3 or later is part of all distributions of
|
|
% LaTeX version 2005/12/01 or later.
|
|
% \fi
|
|
%
|
|
% \iffalse
|
|
%<*driver>
|
|
\ProvidesFile{ifprintedition.dtx}
|
|
%</driver>
|
|
%<package>\NeedsTeXFormat{LaTeX2e}[2005/12/01]
|
|
%<package>\ProvidesPackage{ifprintedition}
|
|
%<*package>
|
|
[2023/07/12 v0.1 Detect class options printedition and webedition]
|
|
%</package>
|
|
%
|
|
%<*driver>
|
|
\documentclass{ltxdoc}
|
|
\usepackage{ifprintedition}[2023/07/12]
|
|
\EnableCrossrefs
|
|
\CodelineIndex
|
|
\RecordChanges
|
|
\begin{document}
|
|
\DocInput{ifprintedition.dtx}
|
|
\PrintChanges
|
|
\end{document}
|
|
%</driver>
|
|
% \fi
|
|
%
|
|
% \CheckSum{32}
|
|
%
|
|
% \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 \~}
|
|
%
|
|
%
|
|
% \changes{v0.1}{2023/07/12}{Initial version}
|
|
%
|
|
% \GetFileInfo{ifprintedition.dtx}
|
|
%
|
|
% \DoNotIndex{\newcommand,\newenvironment}
|
|
%
|
|
%
|
|
% \title{The \textsf{ifprintedition} package\thanks{This document
|
|
% corresponds to \textsf{ifprintedition}~\fileversion, dated \filedate.}}
|
|
% \author{Taha Ahmed \\ \texttt{taha@chepec.se}}
|
|
%
|
|
% \maketitle
|
|
%
|
|
% \section{Introduction}
|
|
%
|
|
% Please also see the adjoining \texttt{README.md} file.
|
|
%
|
|
% \section{Usage}
|
|
%
|
|
% The two macros in this package are purposefully designed to work similar to
|
|
% \texttt{\\ifdraft\{\}\{\}} from the \texttt{ifdraft} package.
|
|
%
|
|
% \DescribeMacro{\ifwebedition\{\}\{\}}
|
|
% Code in the first block will be executed if the documentclass option
|
|
% \texttt{webedition} was set (this is controlled in the documentclass
|
|
% \texttt{cls} file, see this
|
|
% \href{https://git.solarchemist.se/config/texmf-latex/commit/ba83966ffb39037547e2b800629972f8bf5e6706}{commit}
|
|
% for an example).
|
|
% Conversely, code in the second block will be executed if the option \texttt{webedition}
|
|
% was \emph{not} set (which means that \texttt{printedition} is set, just like
|
|
% the \texttt{draft} and \texttt{final} options behave).
|
|
%
|
|
% \DescribeMacro{\ifprintedition\{\}\{\}}
|
|
% Provided for convenience, as it is not really necessary in light of its
|
|
% sister function above.
|
|
% If it suits you better, use it.
|
|
%
|
|
% \StopEventually{}
|
|
%
|
|
% \section{Implementation}
|
|
%
|
|
% \begin{macrocode}
|
|
\newif\if@printedition
|
|
\newif\if@option@printedition
|
|
\newif\if@option@webedition
|
|
\DeclareOption{printedition}{%
|
|
\@printeditiontrue
|
|
\@option@printeditiontrue
|
|
}
|
|
\DeclareOption{webedition}{%
|
|
\@printeditionfalse
|
|
\@option@webeditiontrue
|
|
}
|
|
\ProcessOptions*\relax
|
|
% \end{macrocode}
|
|
% \begin{macro}{\ifprintedition}
|
|
% \begin{macrocode}
|
|
\newcommand*{\ifprintedition}{%
|
|
\if@printedition
|
|
\expandafter\@firstoftwo
|
|
\else
|
|
\expandafter\@secondoftwo
|
|
\fi
|
|
}
|
|
% \end{macrocode}
|
|
% \end{macro}
|
|
% \begin{macro}{\ifwebedition}
|
|
% \begin{macrocode}
|
|
\newcommand*{\ifwebedition}{%
|
|
\if@webedition
|
|
\expandafter\@firstoftwo
|
|
\else
|
|
\expandafter\@secondoftwo
|
|
\fi
|
|
}
|
|
% \end{macrocode}
|
|
% \end{macro}
|
|
%
|
|
% \Finale
|
|
\endinput
|