-
Notifications
You must be signed in to change notification settings - Fork 20
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
TraditionalForm in output cells #51
Comments
Yes it's possible. It should more or less work out of the box. The thing is that For If you could provide some examples of cells that you want to convert, and write what you don't like in default Maybe some combination of |
Thanks for your reply. I'll try a combination of the two. As I have many cells to insert in the book is it possible to omit the cell numbers? |
If you want to keep cell labels, just without the numbers, you can use If you want to completely get rid of labels together with their additional margins, you can switch off \documentclass[12pt]{article}
\usepackage{mmacells}
\begin{document}
Default behavior:
\begin{mmaCell}{Input}
a+a
\end{mmaCell}
\begin{mmaCell}{Output}
2 a
\end{mmaCell}
Redefined cell styles:
\mmaDefineCellStyle{Input}{
style/Code,
formatted,
annotations=false,
mathreplacements=bold,
% label={In[\mmaCellIndex]:=},
label={In[]:=},
}
\mmaDefineCellStyle{Output}{
indexed,
formatted,
mathreplacements=light,
morelst={style=MathematicaFrontEndOut},
% label={Out[\mmaCellIndex]\mmaCellForm*=},
label={Out[]\mmaCellForm*=},
}
\begin{mmaCell}{Input}
a+a
\end{mmaCell}
\begin{mmaCell}{Output}
2 a
\end{mmaCell}
No \verb|list| wrappers at all:
\mmaSet{uselist=false}
\begin{mmaCell}{Input}
a+a
\end{mmaCell}
\begin{mmaCell}{Output}
2 a
\end{mmaCell}
\end{document} |
Thank you very much! I try |
I tried to combine your style with the the Mathematica LaTeX conversion: Compute the following integer powers of the imaginary unit: \begin{mmaCell}{Input} \begin{mmaCell}{Output} \end{mmaCell}{Output} \begin{doublespace} but I'm not able to insert the output after Out[] keeping the TraditionalForm. How can I do? Thanks |
I send you a notebook I want to convert for my book (the problem is also with Mathematica fonts e.g. for the imaginary unit). Thank you for your support |
Hi,
Thanks for your kind reply. I attach the Mathematica notebook I want to
insert in the book
Best Regards
Carlo Gabrieli
[image: Mailtrack]
<https://mailtrack.io?utm_source=gmail&utm_medium=signature&utm_campaign=signaturevirality11&>
Sender
notified by
Mailtrack
<https://mailtrack.io?utm_source=gmail&utm_medium=signature&utm_campaign=signaturevirality11&>
14/03/22,
09:03:03
Il giorno dom 13 mar 2022 alle ore 17:16 Jakub Kuczmarski <
***@***.***> ha scritto:
… If you want to keep cell labels, just without the numbers, you can use
label option. To automatically change labels in all cells you can
redefine appropriate cell styles, as shown below. You can put anything you
like in the label option, even leave it completely empty, then no labels
will be shown.
If you want to completely get rid of labels together with their additional
margins, you can switch off list wrappers, that are internally used to
provide labels, by using uselist=false option.
\documentclass[12pt]{article}\usepackage{mmacells}
\begin{document}
Default behavior:\begin{mmaCell}{Input}
a+a\end{mmaCell}\begin{mmaCell}{Output}
2 a\end{mmaCell}
Redefined cell styles:\mmaDefineCellStyle{Input}{
style/Code,
formatted,
annotations=false,
mathreplacements=bold,% label={In[\mmaCellIndex]:=},
label={In[]:=},
}\mmaDefineCellStyle{Output}{
indexed,
formatted,
mathreplacements=light,
morelst={style=MathematicaFrontEndOut},% label={Out[\mmaCellIndex]\mmaCellForm*=},
label={Out[]\mmaCellForm*=},
}\begin{mmaCell}{Input}
a+a\end{mmaCell}\begin{mmaCell}{Output}
2 a\end{mmaCell}
No \verb|list| wrappers at all:\mmaSet{uselist=false}\begin{mmaCell}{Input}
a+a\end{mmaCell}\begin{mmaCell}{Output}
2 a\end{mmaCell}
\end{document}
[image: output]
<https://user-images.githubusercontent.com/4525409/158068601-756add5f-789d-498f-839d-0c5f842aeb35.png>
—
Reply to this email directly, view it on GitHub
<#51 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/ATN7KJ4O7W6S2TNMOQGMVO3U7YIDZANCNFSM5PTXGVPA>
.
Triage notifications on the go with GitHub Mobile for iOS
<https://apps.apple.com/app/apple-store/id1477376905?ct=notification-email&mt=8&pt=524675>
or Android
<https://play.google.com/store/apps/details?id=com.github.android&referrer=utm_campaign%3Dnotification-email%26utm_medium%3Demail%26utm_source%3Dgithub>.
You are receiving this because you authored the thread.Message ID:
***@***.***>
|
Put relevant code inside
If you're using Unicode-aware engine (xetex, luatex) you can use Mathematica fonts directly with Putting it together we get: \documentclass{article}
\usepackage{fontspec}
\usepackage{newunicodechar}
\usepackage{setspace}
\usepackage{mmacells}
% Replace given `Path`s with proper paths on your system.
\newfontfamily\mmarmfamily{Mathematica}[
Extension = .ttf ,
Path = /home/jkuczm/local/Wolfram/Mathematica/11.0/SystemFiles/Fonts/TrueType/ ,
BoldFont = *-Bold ]
\DeclareTextFontCommand{\textmmarm}{\mmarmfamily}
\newfontfamily\mmasffamily{MathematicaSans}[
Extension = .ttf ,
Path = /home/jkuczm/local/Wolfram/Mathematica/11.0/SystemFiles/Fonts/TrueType/ ,
BoldFont = *-Bold ]
\DeclareTextFontCommand{\textmmasf}{\mmasffamily}
\newfontfamily\mmattfamily{MathematicaMono}[
Extension = .ttf ,
Path = /home/jkuczm/local/Wolfram/Mathematica/11.0/SystemFiles/Fonts/TrueType/ ,
BoldFont = *-Bold ]
\DeclareTextFontCommand{\textmmatt}{\mmattfamily}
\newcommand\MathematicalDoubleStruckSmallIWrapper{}
\newunicodechar{𝕚}{\MathematicalDoubleStruckSmallIWrapper{𝕚}}
\newcommand\DoubleStruckItalicSmallIWrapper{}
\newunicodechar{ⅈ}{\DoubleStruckItalicSmallIWrapper{ⅈ}}
\newenvironment{traditionalFormOutputInner}
{%
\renewcommand\DoubleStruckItalicSmallIWrapper{\textmmarm}
\begin{doublespace}%
}
{%
\end{doublespace}%
}
\mmaDefineCellStyle{Input}{
style/Code,
formatted,
annotations=false,
mathreplacements=bold,
% label={In[\mmaCellIndex]:=},
label=\textit{\color{black!60}In[\textcolor{black!10}{\textbullet}]:=},
morefv={formatcom*={\renewcommand\MathematicalDoubleStruckSmallIWrapper{\textmmatt}}},
}
\mmaDefineCellStyle{Output}{
indexed,
formatted,
mathreplacements=light,
morelst={style=MathematicaFrontEndOut},
% label={Out[\mmaCellIndex]\mmaCellForm*=},
label=\textit{\color{black!60}Out[\textcolor{black!10}{\textbullet}]=},
verbatimenv=traditionalFormOutputInner,
}
\begin{document}
\begin{mmaCell}{Input}
\(\Big\{\mmaSup{𝕚}{125},\mmaSup{𝕚}{34},\mmaFrac{1}{\mmaSup{𝕚}{5}},\mmaSup{𝕚}{-15}\Big\}\)
\end{mmaCell}
\begin{mmaCell}{Output}
\(\{ⅈ,-1,-ⅈ,ⅈ\}\)
\end{mmaCell}
\end{document} |
Thanks, I'll take a look.
Best Regards and thanks again
Carlo Gabrieli
[image: Mailtrack]
<https://mailtrack.io?utm_source=gmail&utm_medium=signature&utm_campaign=signaturevirality11&>
Sender
notified by
Mailtrack
<https://mailtrack.io?utm_source=gmail&utm_medium=signature&utm_campaign=signaturevirality11&>
14/03/22,
13:48:47
Il giorno lun 14 mar 2022 alle ore 13:35 Jakub Kuczmarski <
***@***.***> ha scritto:
… I'm not able to insert the output after Out[] keeping the TraditionalForm.
Put relevant code inside mmaCell environment.
You should also change "verbatim environment" to something that is not
actually verbatim, this can be done using verbatimenv=... option.
the problem is also with Mathematica fonts e.g. for the imaginary unit
If you're using Unicode-aware engine (xetex, luatex) you can use
Mathematica fonts directly with fontspec package
<https://ctan.org/pkg/fontspec>. Just define \newfontfamily pointing to
proper files in your Mathematica installation directory.
You can also directly use unicode characters: 𝕚
<https://www.fileformat.info/info/unicode/char/1d55a/index.htm> and ⅈ
<https://www.fileformat.info/info/unicode/char/2148/index.htm> and
instruct TeX to use Mathematica font for them using newunicodechar package
<https://ctan.org/pkg/newunicodechar>.
Putting it together we get:
\documentclass{article}
\usepackage{fontspec}
\usepackage{newunicodechar}
\usepackage{setspace}
\usepackage{mmacells}
% Replace given `Path`s with proper paths on your system.
\newfontfamily\mmarmfamily{Mathematica}[
Extension = .ttf ,
Path = /home/jkuczm/local/Wolfram/Mathematica/11.0/SystemFiles/Fonts/TrueType/ ,
BoldFont = *-Bold ]
\DeclareTextFontCommand{\textmmarm}{\mmarmfamily}
\newfontfamily\mmasffamily{MathematicaSans}[
Extension = .ttf ,
Path = /home/jkuczm/local/Wolfram/Mathematica/11.0/SystemFiles/Fonts/TrueType/ ,
BoldFont = *-Bold ]
\DeclareTextFontCommand{\textmmasf}{\mmasffamily}
\newfontfamily\mmattfamily{MathematicaMono}[
Extension = .ttf ,
Path = /home/jkuczm/local/Wolfram/Mathematica/11.0/SystemFiles/Fonts/TrueType/ ,
BoldFont = *-Bold ]
\DeclareTextFontCommand{\textmmatt}{\mmattfamily}
\newcommand\MathematicalDoubleStruckSmallIWrapper{}
\newunicodechar{𝕚}{\MathematicalDoubleStruckSmallIWrapper{𝕚}}
\newcommand\DoubleStruckItalicSmallIWrapper{}
\newunicodechar{ⅈ}{\DoubleStruckItalicSmallIWrapper{ⅈ}}
\newenvironment{traditionalFormOutputInner}
{%
\renewcommand\DoubleStruckItalicSmallIWrapper{\textmmarm}
\begin{doublespace}%
}
{%
\end{doublespace}%
}
\mmaDefineCellStyle{Input}{
style/Code,
formatted,
annotations=false,
mathreplacements=bold,
% label={In[\mmaCellIndex]:=},
label=\textit{\color{black!60}In[\textcolor{black!10}{\textbullet}]:=},
morefv={formatcom*={\renewcommand\MathematicalDoubleStruckSmallIWrapper{\textmmatt}}},
}
\mmaDefineCellStyle{Output}{
indexed,
formatted,
mathreplacements=light,
morelst={style=MathematicaFrontEndOut},
% label={Out[\mmaCellIndex]\mmaCellForm*=},
label=\textit{\color{black!60}Out[\textcolor{black!10}{\textbullet}]=},
verbatimenv=traditionalFormOutputInner,
}
\begin{document}
\begin{mmaCell}{Input}
\(\Big\{\mmaSup{𝕚}{125},\mmaSup{𝕚}{34},\mmaFrac{1}{\mmaSup{𝕚}{5}},\mmaSup{𝕚}{-15}\Big\}\)
\end{mmaCell}
\begin{mmaCell}{Output}
\(\{ⅈ,-1,-ⅈ,ⅈ\}\)
\end{mmaCell}
\end{document}
which compiles to:
[image: xetex]
<https://user-images.githubusercontent.com/4525409/158172488-438d013c-0ca6-4e03-9167-fb976b8c1513.png>
—
Reply to this email directly, view it on GitHub
<#51 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/ATN7KJ4DOKVGCRBDX77OA2LU74XAVANCNFSM5PTXGVPA>
.
Triage notifications on the go with GitHub Mobile for iOS
<https://apps.apple.com/app/apple-store/id1477376905?ct=notification-email&mt=8&pt=524675>
or Android
<https://play.google.com/store/apps/details?id=com.github.android&referrer=utm_campaign%3Dnotification-email%26utm_medium%3Demail%26utm_source%3Dgithub>.
You are receiving this because you authored the thread.Message ID:
***@***.***>
|
Hi, Sorry to bother you. Currently I'm using Overleaf and I have trouble loading Mathematica fonts on their cloud. So I give up using Mathematica fonts for now. Please help me to use verbatimenv=... option to obtain an output similar to TraditionalForm. I tried \mmaSet{uselist=true} \end{mmaCell} but I'm not satisfied. See the png file for the LaTeX output. Thanks for your help and patience |
Try: \documentclass{article}
\usepackage{setspace}
\usepackage{mmacells}
\mmaDefineCellStyle{Input}{
style/Code,
formatted,
annotations=false,
mathreplacements=bold,
label=\textit{\color{black!60}In[\textcolor{black!10}{\textbullet}]:=},
}
\mmaDefineCellStyle{Output}{
indexed,
formatted,
mathreplacements=light,
morelst={style=MathematicaFrontEndOut},
label=\textit{\color{black!60}Out[\textcolor{black!10}{\textbullet}]=},
verbatimenv=doublespace,
}
\begin{document}
\begin{mmaCell}{Input}
\(\Big\{\mmaSup{I}{125},\mmaSup{I}{34},\mmaFrac{1}{\mmaSup{I}{5}},\mmaSup{I}{-15}\Big\}\)
\end{mmaCell}
\begin{mmaCell}{Output}
\(\{\mathsf{i},-1,-\mathsf{i},\mathsf{i}\}\)
\end{mmaCell}
\end{document} |
Thank you very much,
I'll try
Best Regards
Carlo Gabrieli
[image: Mailtrack]
<https://mailtrack.io?utm_source=gmail&utm_medium=signature&utm_campaign=signaturevirality11&>
Sender
notified by
Mailtrack
<https://mailtrack.io?utm_source=gmail&utm_medium=signature&utm_campaign=signaturevirality11&>
15/03/23,
08:05:24
Il giorno mar 14 mar 2023 alle ore 23:40 Jakub Kuczmarski <
***@***.***> ha scritto:
… Try:
\documentclass{article}
\usepackage{setspace}\usepackage{mmacells}
\mmaDefineCellStyle{Input}{
style/Code,
formatted,
annotations=false,
mathreplacements=bold,
label=\textit{\color{black!60}In[\textcolor{black!10}{\textbullet}]:=},
}\mmaDefineCellStyle{Output}{
indexed,
formatted,
mathreplacements=light,
morelst={style=MathematicaFrontEndOut},
label=\textit{\color{black!60}Out[\textcolor{black!10}{\textbullet}]=},
verbatimenv=doublespace,
}
\begin{document}
\begin{mmaCell}{Input}\(\Big\{\mmaSup{I}{125},\mmaSup{I}{34},\mmaFrac{1}{\mmaSup{I}{5}},\mmaSup{I}{-15}\Big\}\)\end{mmaCell}
\begin{mmaCell}{Output}\(\{\mathsf{i},-1,-\mathsf{i},\mathsf{i}\}\)\end{mmaCell}
\end{document}
—
Reply to this email directly, view it on GitHub
<#51 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/ATN7KJZGQHGB6GGB3RTT56TW4DXWNANCNFSM5PTXGVPA>
.
You are receiving this because you authored the thread.Message ID:
***@***.***>
|
Hi,
Is it possible to obtain the Mathematica TraditionalForm in an output cell generated in a Mathematica notebook with MathematicaCellsToTeX and Mmacells?
Thanks
The text was updated successfully, but these errors were encountered: