diff --git a/.gitignore b/.gitignore index 38b6370..6702713 100644 --- a/.gitignore +++ b/.gitignore @@ -12,3 +12,4 @@ # *.pdf # *.sty *.log +*.code-workspace diff --git a/README.md b/README.md index 9b28ae8..a3bed2e 100644 --- a/README.md +++ b/README.md @@ -9,7 +9,7 @@ but for two other documentclass options, namely, The `.dtx` file is the source, in combination with the `.ins` file. -**Step 1**: generate the `.sty` file using TeX. +**Step 1**: generate the `.sty` file using TeX: `tex ifprintedition.ins` ``` taha@luxor:/usr/local/texlive/texmf-local/tex/latex/ifprintedition $ tex ifprintedition.ins @@ -65,7 +65,7 @@ is very annoying. > the interactive confirmation step. -**Step 2**: generate PDF documentation from `dtx` using LaTeX. +**Step 2**: generate PDF documentation from `dtx` using LaTeX: `pdflatex ifprintedition.dtx` ``` taha@luxor:/usr/local/texlive/texmf-local/tex/latex/ifprintedition $ pdflatex ifprintedition.dtx @@ -97,7 +97,7 @@ Now is a good time to edit the `% \CheckSum{0}` line in the `dtx` file with the correct number. > Note, during development you might want to reset to `\CheckSum{0}` to -> avoid compilation errors. +> avoid compilation errors and having to reset it manually on every re-compile. And you might want to use `latexmk -pdf ...` instead of `pdflatex ...` to run the requisite number of compilations and also generate index, etc. @@ -116,14 +116,14 @@ This package works in conjunction with the following settings in \@printeditionfalse \DeclareOption{webedition}{ - \PassOptionsToClass{\CurrentOption}{book} - \@webeditiontrue - \@printeditionfalse + \PassOptionsToClass{\CurrentOption}{book} + \@webeditiontrue + \@printeditionfalse } \DeclareOption{printedition}{ - \PassOptionsToClass{\CurrentOption}{book} - \@printeditiontrue - \@webeditionfalse + \PassOptionsToClass{\CurrentOption}{book} + \@printeditiontrue + \@webeditionfalse } ``` @@ -141,3 +141,4 @@ You will need to set something similar in your own documentclass for the + https://tex.stackexchange.com/questions/34175/how-do-i-create-a-latex-package + https://www.overleaf.com/learn/latex/Writing_your_own_package + https://tex.stackexchange.com/questions/21909/classes-and-packages-whats-the-difference ++ https://tex.stackexchange.com/questions/74941/add-option-to-class-with-command diff --git a/ifprintedition.dtx b/ifprintedition.dtx index 2e09647..8a0382a 100644 --- a/ifprintedition.dtx +++ b/ifprintedition.dtx @@ -37,7 +37,6 @@ \begin{document} \DocInput{ifprintedition.dtx} \PrintChanges - \PrintIndex \end{document} % % \fi @@ -70,31 +69,35 @@ % % \title{The \textsf{ifprintedition} package\thanks{This document % corresponds to \textsf{ifprintedition}~\fileversion, dated \filedate.}} -% \author{Taha Ahmed \\ \texttt{taha+ltx@chepec.se}} +% \author{Taha Ahmed \\ \texttt{taha@chepec.se}} % % \maketitle % % \section{Introduction} % -% Put text here. +% Please also see the adjoining \texttt{README.md} file. % % \section{Usage} % -% Put text here. -% -% \DescribeMacro{\dummyMacro} -% This macro does nothing.\index{doing nothing|usage} It is merely an -% example. If this were a real macro, you would put a paragraph here -% describing what the macro is supposed to do, what its mandatory and -% optional arguments are, and so forth. -% -% \DescribeEnv{dummyEnv} -% This environment does nothing. It is merely an example. -% If this were a real environment, you would put a paragraph here -% describing what the environment is supposed to do, what its -% mandatory and optional arguments are, and so forth. -% -% \StopEventually{\PrintIndex} +% 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} % diff --git a/ifprintedition.pdf b/ifprintedition.pdf index 8290f17..0f7df25 100644 Binary files a/ifprintedition.pdf and b/ifprintedition.pdf differ