diff options
author | Karl Berry <karl@freefriends.org> | 2017-09-16 20:47:20 +0000 |
---|---|---|
committer | Karl Berry <karl@freefriends.org> | 2017-09-16 20:47:20 +0000 |
commit | 777efec5d239eaae59b9eae8e47bc2bcff303307 (patch) | |
tree | c4e96c0a1367dffafac4482c51e86d60f56ca519 | |
parent | c33f8322a322e3985d91ec6e03b4b5a7136add0b (diff) |
complexity (16sep17)
git-svn-id: svn://tug.org/texlive/trunk@45322 c570f23f-e606-0410-a88d-b1316a301751
-rw-r--r-- | Master/texmf-dist/doc/latex/complexity/README | 19 | ||||
-rw-r--r-- | Master/texmf-dist/doc/latex/complexity/complexity.pdf | bin | 203822 -> 257609 bytes | |||
-rw-r--r-- | Master/texmf-dist/doc/latex/complexity/complexity.tex | 213 | ||||
-rw-r--r-- | Master/texmf-dist/tex/latex/complexity/complexity.sty | 79 |
4 files changed, 132 insertions, 179 deletions
diff --git a/Master/texmf-dist/doc/latex/complexity/README b/Master/texmf-dist/doc/latex/complexity/README index 049509392cb..865ab971000 100644 --- a/Master/texmf-dist/doc/latex/complexity/README +++ b/Master/texmf-dist/doc/latex/complexity/README @@ -9,3 +9,22 @@ Written by Chris Bourke <cbourke@cse.unl.edu> No dependencies other than the standard ifthen package. See complexity.pdf for full documentation + +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +% +% Copyright and license +% ===================== +% +% Copyright (C) 2017 Chris Bourke +% +% This file 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. The latest version of this +% license is in: +% +% http://www.latex-project.org/lppl.txt +% +% and version 1.3c or later is part of all distributions of LaTeX +% version 2008/05/04 or later. +% +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% diff --git a/Master/texmf-dist/doc/latex/complexity/complexity.pdf b/Master/texmf-dist/doc/latex/complexity/complexity.pdf Binary files differindex 951d83288e9..e83b01f00d3 100644 --- a/Master/texmf-dist/doc/latex/complexity/complexity.pdf +++ b/Master/texmf-dist/doc/latex/complexity/complexity.pdf diff --git a/Master/texmf-dist/doc/latex/complexity/complexity.tex b/Master/texmf-dist/doc/latex/complexity/complexity.tex index 4312c09308f..97e4102e8c6 100644 --- a/Master/texmf-dist/doc/latex/complexity/complexity.tex +++ b/Master/texmf-dist/doc/latex/complexity/complexity.tex @@ -1,12 +1,12 @@ % complexity latex package documentation -% Copyright 2005, by Chris Bourke <cbourke@cse.unl.edu>. -% http://www.cse.unl.edu/~cbourke +% Copyright 2017, by Chris Bourke <cbourke@cse.unl.edu> +% http://chrisbourke.unl.edu % % Please do not distribute altered versions of this document \documentclass{ltxdoc} -\def\complexityversion{0.80} +\def\complexityversion{0.81a} %\usepackage{amsmath} \usepackage[pdftex,a4paper,colorlinks,pdfpagemode=None]{hyperref} @@ -19,9 +19,7 @@ \begin{document} \title{User's Guide for \texttt{complexity}: a \LaTeX\ package, Version \complexityversion} -\author{Chris Bourke\\ -% \href{mailto:cbourke@cse.unl.edu}{\texttt{cbourke@cse.unl.edu}} -} +\author{Chris Bourke} \date{\today} \maketitle @@ -39,46 +37,6 @@ such as $\SAT$ (satisfiability). In all, over 350 commands are defined for helping you to typeset Computational Complexity constructs. -\subsection{Why a \texttt{complexity} package?} - -A better question is why not? Complexity theory is a more recent, -though mature area of Theoretical Computer Science. Each researcher -seems to have his or her own preferences as to how to typeset -Complexity Classes and has built up their own personal \LaTeX\ -commands file. This can be frustrating, to say the least, when it -comes to collaborations or when one has to go through an entire -series of files changing commands for compatibility or to get -exactly the look they want (or what may be required). I find it -amazing that a package hasn't been written \emph{already}! (Maybe -there has been, but I've not found it). - -I thought the best solution would be to develop a single \LaTeX\ -package to handle all of this for us. - -\section{Installation} - -You should place the |complexity| directory and its files -(|complexity.sty| and |mycomplexity.sty| as well the documentation -files if you like) in a place that your \TeX\ distribution will be -able to find them. - -If you use MiK\TeX\ then you should place it in your |localtexmf| -directory, making sure to refresh your \TeX\ tree (MiK\TeX\ options -wizard $\rightarrow$ General $\rightarrow$ File Names Database, -Refresh Now). - -In a unix \TeX\ distribution, you may find it useful to use a local -\LaTeX\ path (i.e. creating a directory -|/usr/local/username/mylatexfolder/| and tell your \TeX\ -distribution where to find it. Depending on your distribution, you -might declare an environmental variable (say -in your |.cshrc| file) like % - -|setenv $TEXINPUTS = /usr/local/texdistro//:/usr/local/username/mylatexfolder//|% - -(note that the double slash will recursively search all -subdirectories). - \section{Package Options} The |complexity| package provides two general options---a @@ -108,10 +66,7 @@ commands for complexity classes. By default, \emph{every} the number of commands the |complexity| package defines (and perhaps limit conflicts with other packages or your own commands) by using the |basic| option. This option defines only the most commonly used -complexity classes.\footnote{Deciding which classes were most -``common'' was purely based on my judgement, for better or worse. If -I've not considered your favorite complexity class as ``common,'' I -humbly apologize.} +complexity classes. \begin{description} @@ -128,20 +83,15 @@ humbly apologize.} \subsection{Font Options} -Different researchers and different publications have their own -preferences for how to typeset complexity classes. The beauty of -the |complexity| package is that it not only defines a whole sleigh -of complexity classes \emph{for you}, but it also allows you to -change the font they are typeset in with a simple option call. - -The |complexity| package defines three different font entities: a -font for complexity classes (|classfont|), a font for languages -(|langfont|), and a font for functions (|funcfont|). By default, -all of these fonts are typeset using the |mathsf| font. You can -change the font for all of them together or specify a font for each -individually. To apply a single font to all three entities, simply -pass the font (by itself) as an option. The supported font options -are as follows. +You can easily change the fonts for complexity classes using +a package option. The |complexity| package defines three different +font entities: a font for complexity classes (|classfont|), a font +for languages (|langfont|), and a font for functions (|funcfont|). +By default, all of these fonts are typeset using the |mathsf| font. +You can change the font for all of them together or specify a font +for each individually. To apply a single font to all three entities, +simply pass the font (by itself) as an option. The supported font +options are as follows. \begin{description} @@ -221,52 +171,46 @@ Font & |classfont| & |langfont| & |funcfont| \\ A special option is the |small| option and pertains only to how complexity classes (|classfont|) are typeset. Since classes are -typeset in uppercase letters, they tend to be more dominant. This -is not so important for classes such as $\P$ and $\NP$, but if you -are referencing classes such as $\PSPACE$ or $\DTIME$ it can +typeset in uppercase letters, they tend to be more dominant. If +you frequently typeset classes such as $\PSPACE$ or $\DTIME$ it can interrupt the normal flow of text layouts. One solution to this is to typeset classes 1pt smaller than the surrounding text. This is the approach taken in some texts (most notably, Papadimitriou's book -\emph{Computational Complexity}, 1994) and it works quite well. To -illustrate, consider the following: -\begin{quote} -There are deterministic classes such as $\PSPACE \hbox{\small -\PSPACE}$\kern-.3em, nondeterministic classes such as $\NP -\hbox{\small \NP}$\kern-.35em, and functional classes such as $\GapP -\hbox{\small \GapP}$\kern-.35em. But I like them all. -\end{quote} % Internal note: the negative kerning was added here - % for illustration only, the package typesets these classes - % with a correct amount of spacing when |small| is used! - -In the preceding pairs, the first was typeset in the document's -default font size while the second was typeset 1pt smaller -(internally, the |\small| command is used). The difference is +\emph{Computational Complexity}, 1994) and it works quite well. +The following samples illustrate the difference. The first sample +uses the default font size while the second uses a font that is 1pt +smaller (internally, the |\small| command is used). The difference is subtle but when used in a long text, flows more naturally. -To get the same effect using |complexity|, simply use the |small| -option (i.e. |\usepackage[small]{complexity}| with any combination -of the other options (it works for all fonts, but some do not look -as good as others; |typewriter| for example looks bad with this -option). Remember, however that this option only affects how classes -are typeset, not languages. +\begin{quote} +There are deterministic classes such as $\PSPACE$, nondeterministic +classes such as $\NP$, and functional classes such as $\GapP$. But +I like them all. +\end{quote} -It should be noted that this option only affects how classes are -typeset in the display and in-line mathmodes. It has no effect in, -say, a footnote or some special environment. Subscripts, -superscripts (as well as subsubscripts and supersuperscripts) are -not effected either---\TeX\ is allowed to automatically change font -sizes for these cases. +\begin{quote} +There are deterministic classes such as $\hbox{\small\PSPACE}$, +nondeterministic classes such as $\hbox{\small \NP}$, and functional +classes such as $\hbox{\small \GapP}$. But I like them all. +\end{quote} +To get the same effect using |complexity|, use the |small| +option: -\section{Using the Package} +|\usepackage[small]{complexity}| + +with any combination of the other options (it works for all +fonts, but some do not look as good as others; |typewriter| +for example looks bad with this option). Remember, however +that this option only affects how classes are typeset, not +languages. -Each of the commands is defined using |\ensuremath| so that you need -not be in \LaTeX's mathmode to use them. A word of warning, -however, if you use a command outside of mathmode, \TeX\ may not -properly insert surrounding whitespace. Thus, its best to always -use |complexity| commands inside mathmode. A complete list of -commands for classes can be found in Section -\ref{sec:CompleteListOfComplexityCommands}. +This option only affects how classes are +typeset in the display and in-line mathmodes. It has no effect in +a footnote or some special environment. Subscripts, +superscripts (as well as subsubscripts and supersuperscripts) are +not effected either. \TeX\ is allowed to automatically change font +sizes for these cases. \subsection{Overridden Commands} @@ -278,14 +222,26 @@ symbol \defaultS) are all redefined for use in the package. The use them. To use any of these symbols, use the commands |\defaultL|, |\defaultP|, and |\defaultS| instead. -Additionally, it may be the case that other \LaTeX\ packages are -loaded that already define (or redefine) some of the commands in the -|complexity| package. If this is the case, please email me so that -I can work something out for future updates. The quick solution is -to simply comment out the definition of the conflicting command in -|complexity.sty| and directly use |\ComplexityFont{}| to typeset -your complexity class (see also Section \ref{sec:Customization} - -Customization). +In some situations this redefinition is not desirable (if you need +these symbols but cannot use the |\default| versions). You can +disable the overriding of these three commands using the option +|disableredefinitions|; for example: + +|\usepackage[disableredefinitions]{complexity}| + +Three alternatives are defined if you disable the overrides: +|\cL|, |\cP| and |\cS| that typeset the classes $\cL$, $\cP$ +and $\cS$ respectively. + + +\section{Using the Package} + +Each of the commands is defined using |\ensuremath| so that you +need not be in \LaTeX's mathmode to use them. However, if you +use a command outside of mathmode, \TeX\ may not properly insert +surrounding whitespace. It is recommended to always use |complexity| +commands inside mathmode. A complete list of commands for classes +can be found in Section \ref{sec:CompleteListOfComplexityCommands}. \subsection{Special Commands} @@ -305,10 +261,10 @@ a complete list of these functions. \centering % \caption{\texttt{func} Commands} % \label{table:SpecialCommands} -\begin{tabular}{llp{7cm}} +\begin{tabular}{llp{8cm}} Command & Result & Comment \\ -\hline\hline\\ -|\llog| & $\llog$ & Denotes logarithmic functions. Note that the command % +\hline\hline +|\llog| & $\llog$ & Denotes logarithmic functions. The command % is invoked with \emph{two} l's so as to not interfere with the \LaTeX\ |\log| command.\\ |\poly| & $\poly$ & Denotes polynomial functions \\ @@ -324,9 +280,9 @@ Command & Result & Comment \\ \subsection{Language Commands} -|complexity| also defines commands to typeset languages (subsets of -$\{0,1\}^*$). A complete list of predefined language commands can -be found in Table \ref{table:LanguageCommands} below. The number of +|complexity| also defines commands to typeset languages. +A complete list of predefined language commands can +be found in Table \ref{table:LanguageCommands}. The number of commands is sparse; this was intentional. How one refers to languages is far less standard than how one refers to classes. Some people like to explicitly write \emph{every} word @@ -527,34 +483,11 @@ $$\PH \subseteq \P^{\#\P}$$ \hrule -For an even more complicated example, check out the \LaTeX ed (PDF) -version of the Complexity Zoo (\url{http://www.ComplexityZoo.com}) -available on my webpage (\url{http://www.cse.unl.edu/~cbourke}) - -\section{Feedback} - -I'd very much appreciate feedback that would improve this package. -Specifically, I'm looking for the following. - -\begin{itemize} - - \item Inconsistencies in (or suggestions for better) notation - - \item Errors, Typos, etc - - \item Incompatibilities with other packages - - \item Feature requests - -\end{itemize} - -You can email me at -\href{mailto:cbourke@cse.unl.edu}{cbourke@cse.unl.edu} - \subsection{Acknowledgements} I'd like to thank Till Tantau for several useful suggestions and feature requests as well as some clever code segments for the -|small| option. +|small| option. I'd also like to thank Enrico Gregorio for the +suggested fix to disable redefinitions. \end{document} diff --git a/Master/texmf-dist/tex/latex/complexity/complexity.sty b/Master/texmf-dist/tex/latex/complexity/complexity.sty index 6a57384e02b..8acec3ac4d2 100644 --- a/Master/texmf-dist/tex/latex/complexity/complexity.sty +++ b/Master/texmf-dist/tex/latex/complexity/complexity.sty @@ -13,8 +13,32 @@ % %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % +% Copyright and license +% ===================== +% +% Copyright (C) 2017 Chris Bourke +% +% This file 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. The latest version of this +% license is in: +% +% http://www.latex-project.org/lppl.txt +% +% and version 1.3c or later is part of all distributions of LaTeX +% version 2008/05/04 or later. +% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % +% Changes made (.81 -> .81a, 2017/09/16) +% -Updated copyright, added LPPL 1.3c +% Changes made (.80 -> .81, 2017/09/15) +% -Removed \typeout message +% -Cleaned up comments +% -Added package option (disableredefinitions) to disable redefinitions +% of \L, \P, \S for authors that need the originals but cannot use the +% replacements. For backwards compatibility, the they are still redefined +% by default. Thanks to Enrico Gregorio for the fix. % Changes made (.76 -> .80) % -Added a cool message using \typeout! % -Added \newclass, \newlang, \newfunc commands @@ -41,16 +65,9 @@ %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% \NeedsTeXFormat{LaTeX2e} % -\ProvidesPackage{complexity}[11/24/06 \space v0.77] - -\typeout{\space\space +----------------------------------------------+^^J% - \space\space\space\space complexity LaTeX package ^^J% - \space\space\space\space version: ^^J% - \space\space\space\space author: Chris Bourke (cbourke@cse.unl.edu) ^^J% - \space\space +----------------------------------------------+} +\ProvidesPackage{complexity}[09/16/17 \space v0.81a] % Require Packages -%\RequirePackage{keyval}[1997/11/10] \RequirePackage{ifthen} % Declare internal commands @@ -64,7 +81,6 @@ \newcommand{\func}[1]{{\ensuremath{\mathsf{#1}}}} \newcommand{\class}[1]{\ComplexityFont{#1}} -% Experimental: \newcommand{\newclass}[2]{\newcommand{#1}{\ComplexityFont{#2}}} \newcommand{\newlang}[2]{\newcommand{#1}{\lang{#2}}} \newcommand{\newfunc}[2]{\newcommand{#1}{\func{#2}}} @@ -73,7 +89,6 @@ \newcommand{\renewlang}[2]{\renewcommand{#1}{\lang{#2}}} \newcommand{\renewfunc}[2]{\renewcommand{#1}{\func{#2}}} - \newboolean{complexity@fullmode} % \setboolean{complexity@fullmode}{true} \DeclareOption{full}{% @@ -83,56 +98,47 @@ \setboolean{complexity@fullmode}{false}% } % -%%Begin Till Here -%\DeclareOption{roman}{\renewcommand{\complexity@fontcommand{\mathrm}}} -%\DeclareOption{bold}{\renewcommand{\complexity@fontcommand{\mathbf}}} -%... +\newif\ifcomplexity@noredef +\DeclareOption{disableredefinitions}{\complexity@noredeftrue} \DeclareOption{sanserif}{ \renewcommand{\complexity@fontcommand}{\mathsf} - %old: \renewcommand{\ComplexityFont}[1]{{\ensuremath{\mathsf{#1}}}} \renewcommand{\lang}[1]{{\ensuremath{\mathsf{#1}}}} \renewcommand{\func}[1]{{\ensuremath{\mathsf{#1}}}} } \DeclareOption{roman}{ \renewcommand{\complexity@fontcommand}{\mathrm} - %old: \renewcommand{\ComplexityFont}[1]{{\ensuremath{\mathrm{#1}}}} \renewcommand{\lang}[1]{{\ensuremath{\mathrm{#1}}}} \renewcommand{\func}[1]{{\ensuremath{\mathrm{#1}}}} } \DeclareOption{bold}{ \renewcommand{\complexity@fontcommand}{\mathbf} - %old: \renewcommand{\ComplexityFont}[1]{{\hbox{\ensuremath{\mathbf{#1}}}}} \renewcommand{\lang}[1]{{\ensuremath{\mathbf{#1}}}} \renewcommand{\func}[1]{{\ensuremath{\mathbf{#1}}}} } \DeclareOption{typewriter}{ \renewcommand{\complexity@fontcommand}{\mathtt} - %old: \renewcommand{\ComplexityFont}[1]{{\ensuremath{\mathtt{#1}}}} \renewcommand{\lang}[1]{{\ensuremath{\mathtt{#1}}}} \renewcommand{\func}[1]{{\ensuremath{\mathtt{#1}}}} } \DeclareOption{italic}{ \renewcommand{\complexity@fontcommand}{\mathit} - %old: \renewcommand{\ComplexityFont}[1]{{\ensuremath{\mathit{#1}}}} \renewcommand{\lang}[1]{{\ensuremath{\mathit{#1}}}} \renewcommand{\func}[1]{{\ensuremath{\mathit{#1}}}} } \DeclareOption{caps}{ \renewcommand{\complexity@fontcommand}{\textsc} - %old: \renewcommand{\ComplexityFont}[1]{{\ensuremath{\textsc{#1}}}} \renewcommand{\lang}[1]{{\ensuremath{\textsc{#1}}}} \renewcommand{\func}[1]{{\ensuremath{\textsc{#1}}}} } \DeclareOption{slant}{ \renewcommand{\complexity@fontcommand}{\textsl} - %old: \renewcommand{\ComplexityFont}[1]{{\ensuremath{\textsl{#1}}}} \renewcommand{\lang}[1]{{\ensuremath{\textsl{#1}}}} \renewcommand{\func}[1]{{\ensuremath{\textsl{#1}}}} } @@ -140,31 +146,24 @@ % Independent classfonts: \DeclareOption{classfont=sanserif}{ \renewcommand{\complexity@fontcommand}{\mathsf} - %old: \renewcommand{\ComplexityFont}[1]{{\ensuremath{\mathsf{#1}}}} } \DeclareOption{classfont=roman}{ \renewcommand{\complexity@fontcommand}{\mathrm} - %\renewcommand{\ComplexityFont}[1]{{\ensuremath{\mathrm{#1}}}} } \DeclareOption{classfont=bold}{ \renewcommand{\complexity@fontcommand}{\mathbf} - %\renewcommand{\ComplexityFont}[1]{{\ensuremath{\mathbf{#1}}}} } \DeclareOption{classfont=typewriter}{ \renewcommand{\complexity@fontcommand}{\mathtt} - %\renewcommand{\ComplexityFont}[1]{{\ensuremath{\mathtt{#1}}}} } \DeclareOption{classfont=italic}{ \renewcommand{\complexity@fontcommand}{\mathit} - %\renewcommand{\ComplexityFont}[1]{{\ensuremath{\mathit{#1}}}} } \DeclareOption{classfont=caps}{ \renewcommand{\complexity@fontcommand}{\textsc} - %\renewcommand{\ComplexityFont}[1]{{\ensuremath{\textsc{#1}}}} } \DeclareOption{classfont=slant}{ \renewcommand{\complexity@fontcommand}{\textsl} - %\renewcommand{\ComplexityFont}[1]{{\ensuremath{\textsl{#1}}}} } % Independent langfonts: @@ -190,11 +189,6 @@ \renewcommand{\lang}[1]{{\ensuremath{\textsl{#1}}}} } -% If I were to use keyval: -%\define@key{funcfont}{sanserif}{ -% \renewcommand{\func}[1]{{\ensuremath{\mathsf{#1}}}} -%} - % Independent funcfonts: \DeclareOption{funcfont=sanserif}{ \renewcommand{\func}[1]{{\ensuremath{\mathsf{#1}}}} @@ -218,7 +212,6 @@ \renewcommand{\func}[1]{{\ensuremath{\textsl{#1}}}} } - % Till Tantau's Code for the small option: \DeclareOption{small}{ @@ -254,7 +247,7 @@ % Define some internal commands % such as a standard kerning value for several commands -\newcommand{\complexity@kern}{{\kern-.10em}} % note: more {} don't seem to matter, good +\newcommand{\complexity@kern}{{\kern-.10em}} \newcommand{\complexity@hyphen}{ % \lower-.12em\hbox{\textrm{-}} % } @@ -282,14 +275,22 @@ \newcommand{\MaxSAT}{\lang{MaxSAT}} -% We redefine 4 commands inside of Latex, but preserve them for usage +% Alternatives for \L, \P, \S if disabled +\newcommand{\cL}{\ComplexityFont{L}} +\newcommand{\cP}{\ComplexityFont{P}} +\newcommand{\cS}{\ComplexityFont{S}} -\let\defaultL\L +% We redefine 3 commands, but preserve them for usage +\let\defaultL\L % for back compatibility +\let\defaultP\P % for back compatibility +\let\defaultS\S % for back compatibility +% Only redefine if not disabled +\ifcomplexity@noredef\else \renewcommand{\L}{\ComplexityFont{L}} -\let\defaultP\P \renewcommand{\P}{\ComplexityFont{P}} -\let\defaultS\S \renewcommand{\S}{\ComplexityFont{S}} +\fi + % Major Classes listed in Alphabetical order |