matlab equation to latex

Hello,
I am trying to convert a matlab equation to latex using a script like:
chr = latex(x^2 + 1/x)
The output is :'\frac{1}{x}+x^2'
Are there anyway to include '\displaystyle' before \frac

2 Comments

can I have the code for conversion?
What are the rules about where the \displaystyle should be put in?
regexprep(chr, '\\frac', '\\displaystyle\\frac')

Sign in to comment.

 Accepted Answer

Walter Roberson
Walter Roberson on 25 Apr 2023
The latex function does not have any option to add that in automatically, so you would need to use text manipulation to add it in.

More Answers (0)

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!