Comments (3)
changing the interpreter on the legend fixes this one I think:
lh = legend('show','Location','north west');
set(lh,'Interpreter','latex')
regards
from matlab2tikz.
I wouldn't recommend that workaround unless you know what you're doing.
My goal in rewriting the string handling was to get as close a result in the matlab2tikz output to what you see in MATLAB itself. This means that m2t is "bug-compatible" with MATLAB, for instance when it comes to MATLAB interpreting "\alpha \beta" as two greek symbols with a space in between even though a proper TeX interpreter would omit the space as it is the termination of the control sequence. (If you indeed wanted to have a space, proper TeX markup would require either 2 spaces between the greek letters or the sequence "\alpha{} \beta".)
Now, the "latex" interpreter as understood by MATLAB is more true to proper (La)TeX syntax as opposed to MATLAB's "tex" interpreter -- or at least that's what's in the documentation. Judging by the examples on the MathWorks website, text that is to be interpreted by the "latex" interpreter typically, if not always, is put inside an equation environment "$$...$$". What m2t does in the function prettyPrint() is to replace both the two dollar signs at the start and at the end of the string with single dollar signs to use TeX math mode. Since the replacement uses regexprep() there's no replacement whatsoever taking place if the matching criterion "$$...$$" isn't fulfilled.
That's why your workaround works, assuming the legend entries aren't encapsulated in "$$...$$". However, MATLAB might treat them very oddly which brings us back to the original point: Make your text elements like legend entries look the way you want them to in MATLAB first. If the output generated by m2t then deviates from that, please file a bug report. That way it shouldn't be necessary to do any formatting specifically for either MATLAB or matlab2tikz -- which was the goal in rewriting the text handling to begin with.
from matlab2tikz.
First of all, the solution for the original submitter might be more or less what CapsLocker suggested, except that the "interpreter" property shouldn't be set to "latex" but to "none".
Additionally, what was discussed in conjunction with github issue #64 might solve the problem, i.e. the new m2t parameter "parseStrings". Therefore I think this issue should be closed.
from matlab2tikz.
Related Issues (20)
- matlab2tikz generates empty tikz-file when creating polarplot HOT 1
- xticklabel style: number format error
- Text from legendflex has vertical position offset HOT 3
- Can matlab2tikz convert bubblecharts to tikz? HOT 1
- workaround for warning "unknown legend location 'layout'" in tiledlayout
- GDX init failed: Could not load shared library libgdxdclib64.dylib: dlopen(libgdxdclib64.dylib, 2): image not found HOT 1
- Error in `formatPgfTickLabels` with loglog plots HOT 1
- matlab2tikz does not know how to handle object with type "implicitfunctionline"
- Error when using bodeplot HOT 1
- Support for sgtitle
- How to simulate audio signal using Uniform Linear Array using MATLAB HOT 1
- Diseño del cerpentin
- add support for plotting polygons? HOT 2
- minor grid style
- Append font style for axis labels
- Spikes in the Latex plot when using Cleanfigure HOT 2
- question about data out of the xlim or ylim
- IMD Grid Finding
- matlab HOT 1
- Levels in contourf HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from matlab2tikz.