diff options
author | Karl Berry <karl@freefriends.org> | 2014-06-18 23:08:35 +0000 |
---|---|---|
committer | Karl Berry <karl@freefriends.org> | 2014-06-18 23:08:35 +0000 |
commit | 6271138aedb2f61eee0225300db1569008084a10 (patch) | |
tree | 5662b0f680b563f8fb10a07a6f719263186370b8 /Master/texmf-dist/source/latex/skmath | |
parent | d9ded1f7a86fd5831eedd265ad79ab666a390684 (diff) |
skmath (14jun14)
git-svn-id: svn://tug.org/texlive/trunk@34297 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/texmf-dist/source/latex/skmath')
-rw-r--r-- | Master/texmf-dist/source/latex/skmath/skmath.tex | 102 |
1 files changed, 71 insertions, 31 deletions
diff --git a/Master/texmf-dist/source/latex/skmath/skmath.tex b/Master/texmf-dist/source/latex/skmath/skmath.tex index faedf38e12a..2362e57e8a1 100644 --- a/Master/texmf-dist/source/latex/skmath/skmath.tex +++ b/Master/texmf-dist/source/latex/skmath/skmath.tex @@ -1,6 +1,6 @@ %% skmath improved math commands %% -%% Copyright (C) 2012-2013 by Simon Sigurdhsson <sigurdhsson@gmail.com> +%% Copyright (C) 2012-2014 by Simon Sigurdhsson <sigurdhsson@gmail.com> %% %% This work may be distributed and/or modified under the %% conditions of the LaTeX Project Public License, either version 1.3 @@ -42,6 +42,7 @@ % Declare the target files \SelfPreambleTo{\mypreamble} \DeclareFile[key=package,preamble=\mypreamble]{skmath.sty} +\OnlyDescription % Hack for LaTeX3 code \ExplSyntaxOn @@ -53,7 +54,7 @@ % This is where the documentation begins \begin{document} % Change & version info - \version{0.3a} + \version{0.3b} \changes{0.1}{Initial version} \changes{0.1c}{Moved package from \pkg{docstrip} to \pkg{skdoc}} \changes{0.1d}{Fixed fatal documentation and package errors} @@ -62,6 +63,9 @@ \changes{0.2}{Use \pkg{expl3} functionality throughout the package} \changes{0.3}{Added \cs{min}/\cs{max} and friends. Added \cs{pd}} \changes{0.3a}{Added \cs{sinh}, \cs{cosh} and \cs{tanh}} + \changes{0.3b}{Detect empty arguments in trigonometric and logarithmic functions, fix \cs{ln}} + % Don't forget to update the version number and release date of + % the package declaration in the implementation! % Metadata \package[ctan=skmath,vcs=https://github.com/urdh/skmath]{skmath} @@ -196,6 +200,7 @@ argument of the expression, and (if applicable) \meta{power} as a superscript between the function and its argument, \emph{e.g.} \(\sin[2]{\phi}\). + When the argument is empty, no parentheses are emitted: \(\cos{}\). \DescribeMacro\ln{<expression>} The natural logarithm macro \Macro\ln has also been redefined to @@ -204,6 +209,8 @@ The related macro \Macro\log is redefined in a similar way, but also accepts an optional argument denoting the base of the logarithm: \(\log[2]{x}\). + As with the trigonometric functions, no parentheses are emitted if + the mandatory argument is empty: \(\log{}\). \DescribeMacro\exp*{<expression>} The exponential, \Macro\exp, is redefined to typeset its argument as a @@ -250,10 +257,14 @@ \section{Known issues} A list of current issues is available in the Github repository of this package\footnote{\url{https://github.com/urdh/skmath/issues}}, but as - of the release of \theversion, there are no known issues. - %\begin{description} - % \item[\#?] ??? - %\end{description} + of the release of \theversion, there is one known issue. + \begin{description} + \item[\#15] The package is incompatible with (at least) + \pkg{blindtext}, when including math in the blind text. This + is due to the redifinition of \cs{sin} (and friends), which + is incompatible with the original \pkg{amsmath} definition. + This is a feature, not a bug. + \end{description} If you discover any bugs in this package, please report them to the issue tracker in the \thepackage\ Github repository. @@ -267,11 +278,39 @@ \begin{MacroCode}{package} \RequirePackage{expl3,l3keys2e,xparse} \ProvidesExplPackage{skmath} - {2013/06/24}{0.3a}{improved math commands} + {2014/06/13}{0.3b}{improved math commands} \PassOptionsToPackage{intlimits,sumlimits,namelimits}{amsmath} \RequirePackage{amssymb,mathtools,xfrac,isomath} \end{MacroCode} + First, a utility conditional. + \begin{macro*}{\__skmath_if_novalue_or_empty:nF}[1] + {Token or string} +\begin{MacroCode}{package} +\prg_new_conditional:Npnn\__skmath_if_novalue_or_empty:n#1{F}{ + \IfNoValueTF{#1}{ + \prg_return_true: + }{ + \tl_if_empty:nTF{#1}{ + \prg_return_true: + }{ + \prg_return_false: + } + } +} +\end{MacroCode} + \end{macro*} + + And a helper macro. + \begin{macro*}{\__skmath_parens:n}[1] + {Argument to wrap in parentheses, unless empty} +\begin{MacroCode}{package} +\cs_new_nopar:Npn\__skmath_parens:n#1{ + \__skmath_if_novalue_or_empty:nF{#1}{\left(#1\right)} +} +\end{MacroCode} + \end{macro*} + We optionally provide commands to typeset common sets. \begin{macro}{\__skmath_define_common_sets:} \begin{MacroCode}{package} @@ -397,7 +436,7 @@ \cs_new_eq:NN\__skmath_sinh:\sinh \cs_new_eq:NN\__skmath_cosh:\cosh \cs_new_eq:NN\__skmath_tanh:\tanh -\cs_new_eq:NN\__skmath_ln:\log +\cs_new_eq:NN\__skmath_ln:\ln \cs_new_eq:NN\__skmath_log:\log \cs_new_eq:NN\__skmath_exp:\exp \cs_new_eq:NN\__skmath_min:\min @@ -409,8 +448,8 @@ \begin{MacroCode}{package} \RenewDocumentCommand\sin{om}{% \IfNoValueTF{#1} - {\ensuremath{\__skmath_sin:\left(#2\right)}} - {\ensuremath{\__skmath_sin:\c_math_superscript_token{#1}\left(#2\right)}}% + {\ensuremath{\__skmath_sin:\__skmath_parens:n{#2}}} + {\ensuremath{\__skmath_sin:\c_math_superscript_token{#1}\__skmath_parens:n{#2}}}% } \end{MacroCode} \end{macro} @@ -418,8 +457,8 @@ \begin{MacroCode}{package} \RenewDocumentCommand\cos{om}{% \IfNoValueTF{#1} - {\ensuremath{\__skmath_cos:\left(#2\right)}} - {\ensuremath{\__skmath_cos:\c_math_superscript_token{#1}\left(#2\right)}}% + {\ensuremath{\__skmath_cos:\__skmath_parens:n{#2}}} + {\ensuremath{\__skmath_cos:\c_math_superscript_token{#1}\__skmath_parens:n{#2}}}% } \end{MacroCode} \end{macro} @@ -427,8 +466,8 @@ \begin{MacroCode}{package} \RenewDocumentCommand\tan{om}{% \IfNoValueTF{#1} - {\ensuremath{\__skmath_tan:\left(#2\right)}} - {\ensuremath{\__skmath_tan:\c_math_superscript_token{#1}\left(#2\right)}}% + {\ensuremath{\__skmath_tan:\__skmath_parens:n{#2}}} + {\ensuremath{\__skmath_tan:\c_math_superscript_token{#1}\__skmath_parens:n{#2}}}% } \end{MacroCode} \end{macro} @@ -436,29 +475,29 @@ \begin{MacroCode}{package} \RenewDocumentCommand\cot{om}{% \IfNoValueTF{#1} - {\ensuremath{\__skmath_cot:\left(#2\right)}} - {\ensuremath{\__skmath_cot:\c_math_superscript_token{#1}\left(#2\right)}}% + {\ensuremath{\__skmath_cot:\__skmath_parens:n{#2}}} + {\ensuremath{\__skmath_cot:\c_math_superscript_token{#1}\__skmath_parens:n{#2}}}% } \end{MacroCode} \end{macro} \begin{macro}{\arcsin} \begin{MacroCode}{package} \RenewDocumentCommand\arcsin{m}{% - \ensuremath{\__skmath_arcsin:\left(#1\right)}% + \ensuremath{\__skmath_arcsin:\__skmath_parens:n{#1}}% } \end{MacroCode} \end{macro} \begin{macro}{\arccos} \begin{MacroCode}{package} \RenewDocumentCommand\arccos{m}{% - \ensuremath{\__skmath_arccos:\left(#1\right)}% + \ensuremath{\__skmath_arccos:\__skmath_parens:n{#1}}% } \end{MacroCode} \end{macro} \begin{macro}{\arctan} \begin{MacroCode}{package} \RenewDocumentCommand\arctan{m}{% - \ensuremath{\__skmath_arctan:\left(#1\right)}% + \ensuremath{\__skmath_arctan:\__skmath_parens:n{#1}}% } \end{MacroCode} \end{macro} @@ -466,8 +505,8 @@ \begin{MacroCode}{package} \RenewDocumentCommand\sinh{om}{% \IfNoValueTF{#1} - {\ensuremath{\__skmath_sinh:\left(#2\right)}} - {\ensuremath{\__skmath_sinh:\c_math_superscript_token{#1}\left(#2\right)}}% + {\ensuremath{\__skmath_sinh:\__skmath_parens:n{#2}}} + {\ensuremath{\__skmath_sinh:\c_math_superscript_token{#1}\__skmath_parens:n{#2}}}% } \end{MacroCode} \end{macro} @@ -475,8 +514,8 @@ \begin{MacroCode}{package} \RenewDocumentCommand\cosh{om}{% \IfNoValueTF{#1} - {\ensuremath{\__skmath_cosh:\left(#2\right)}} - {\ensuremath{\__skmath_cosh:\c_math_superscript_token{#1}\left(#2\right)}}% + {\ensuremath{\__skmath_cosh:\__skmath_parens:n{#2}}} + {\ensuremath{\__skmath_cosh:\c_math_superscript_token{#1}\__skmath_parens:n{#2}}}% } \end{MacroCode} \end{macro} @@ -484,15 +523,15 @@ \begin{MacroCode}{package} \RenewDocumentCommand\tanh{om}{% \IfNoValueTF{#1} - {\ensuremath{\__skmath_tanh:\left(#2\right)}} - {\ensuremath{\__skmath_tanh:\c_math_superscript_token{#1}\left(#2\right)}}% + {\ensuremath{\__skmath_tanh:\__skmath_parens:n{#2}}} + {\ensuremath{\__skmath_tanh:\c_math_superscript_token{#1}\__skmath_parens:n{#2}}}% } \end{MacroCode} \end{macro} \begin{macro}{\ln} \begin{MacroCode}{package} \RenewDocumentCommand\ln{m}{% - \ensuremath{\__skmath_ln:\left(#1\right)}% + \ensuremath{\__skmath_ln:\__skmath_parens:n{#1}}% } \end{MacroCode} \end{macro} @@ -500,8 +539,8 @@ \begin{MacroCode}{package} \RenewDocumentCommand\log{om}{% \IfNoValueTF{#1} - {\ensuremath{\__skmath_log:\left(#2\right)}} - {\ensuremath{\__skmath_log:\c_math_subscript_token{#1}\left(#2\right)}}% + {\ensuremath{\__skmath_log:\__skmath_parens:n{#2}}} + {\ensuremath{\__skmath_log:\c_math_subscript_token{#1}\__skmath_parens:n{#2}}}% } \end{MacroCode} \end{macro} @@ -511,7 +550,7 @@ \begin{MacroCode}{package} \RenewDocumentCommand\exp{sm}{\ensuremath{ \IfBooleanTF{#1}{ - \__skmath_exp:\left(#2\right) + \__skmath_exp:\__skmath_parens:n{#2} }{ \mathchoice {e\c_math_superscript_token{#2}} @@ -552,7 +591,7 @@ \begin{macro}{\max} \begin{MacroCode}{package} \RenewDocumentCommand\max{som}{% - \ensuremath{\__skmath_max_minbackend:nnnn{max}{#1}{#2}{#3}} + \ensuremath{\__skmath_minmax_backend:nnnn{max}{#1}{#2}{#3}} } \end{MacroCode} \end{macro} @@ -772,8 +811,9 @@ \changes{0.1a}{Fixed obtuse errors} \changes{0.1b}{Moved to \textsf{xparse} command definition} \changes{0.2}{Use \cs{peek_meaning_ignore_spaces:NT} instead of \cs{@ifnextchar}} + \changes{0.3b}{Use \cs{operator@font} instead of \cs{mathrm}} \begin{MacroCode}{package} -\DeclareDocumentCommand\d{m}{\ensuremath{\,\mathrm{d}#1% +\DeclareDocumentCommand\d{m}{\ensuremath{\,{\operator@font d}#1% \peek_meaning_ignore_spaces:NT\d{\!}}} \end{MacroCode} \end{macro} |