Math, asked by anurudramurmu, 7 months ago


 log 2x = 3

Answers

Answered by patelkapila1945
0

Answer:

\log[<base>][<exponent>]{<expression>}

The required redefinition:

\ExplSyntaxOn

\RenewDocumentCommand\log{oom}{%

\IfNoValueTF{#1}

{\ensuremath{\__skmath_log:\IfNoValueTF{#2}{}{\c_math_superscript_token{#2}}\__skmath_parens:n{#3}}}

{\ensuremath{\__skmath_log:\c_math_subscript_token{#1}\IfNoValueTF{#2}{}{\c_math_superscript_token{#2}}\__skmath_parens:n{#3}}}%

}

\ExplSyntaxOff

A complete document, with a multitude of test cases showing the behavior for omitted/empty arguments:

\documentclass{article}

\usepackage{skmath}

\ExplSyntaxOn

\RenewDocumentCommand\log{oom}{%

\IfNoValueTF{#1}

{\ensuremath{\__skmath_log:\IfNoValueTF{#2}{}{\c_math_superscript_token{#2}}\__skmath_parens:n{#3}}}

{\ensuremath{\__skmath_log:\c_math_subscript_token{#1}\IfNoValueTF{#2}{}{\c_math_superscript_token{#2}}\__skmath_parens:n{#3}}}%

}

\ExplSyntaxOff

\begin{document}

\begin{gather}

\log[10][2]{x} \\

\log[10][]{x} \\

\log[10]{x} \\

\log[][2]{x} \\

\log[][]{x} \\

\log[]{x} \\

\log{x} \\

\log[10][2]{} \\

\log[10][]{} \\

\log[][2]{} \\

\log[][]{}

\end{gather}

\end{document}

Similar questions