Closed magerton closed 8 years ago
So, this technically isn't a bug. when you delimit characters in LaTeX using $$
$$
or $
$
{or \[
\]
\(
\)
} or even just { }
you create an environment and implicitly define their scope.
Note that you used \newcommand
twice, which would have erred if they weren't inside their respective environments.
So technically it's the notebook that is behaving improperly. It shouldn't allow it to get outside of individual environment scopes. Also, if it did have global scope, it should raise an error for declaring newcommand when a command already existed.
If you want it to convert properly when exported to LaTeX or pdf; you can include it in a raw nbconvert cell and it will be left untouched in your LaTeX document, and it will be defined and accessible outside of a specific math environment.
Thanks, @michaelpacer. That totally makes sense.
In a Julia 0.45 Jupyter Notebook, though LaTeX
\newcommand
macros are valid for a whole notebook when defined in a math environment, when the document is converted to LaTeX via File > Download as PDF, it looks like the\newcommand
is only valid within that specific math environment.The following MWE will throw an error and report that the third line contains an undefined control sequence.
Version information:
Julia: Version 0.4.5 (2016-03-18 00:58 UTC) Official http://julialang.org/ release x86_64-w64-mingw32