Math when exporting to latex

0 votes
asked Sep 20, 2018 in Wanted features by Stas
Hello, I wonder why I cannot use math when exporting to latex.

All dollar signs are replaced by \$ and therefore no math environment is used.

It would be really a great thing if one could simple use latex syntax for all entries and use text mode and math mode and see it in the latex file later on.

Possible an option whether to backlslash certain symbols would be nice.

A second thing is, would it also be possible to remove the standalone from the latex file and only get the actual tikz figure which then can be imported into other latex files?

3 Answers

0 votes
answered Sep 20, 2018 by plantuml (294,960 points)

Well, we are not LaTeX expert here, but I think $ has to be prefixed with \ to be printed (see https://tex.stackexchange.com/questions/351442/write-a-currency-symbol )

Otherwhile example like:

@startuml
A->B : Hello $20
@enduml

won't work.

Maybe you can post a simple snipset (with math, if I understand right) so that we better understand the issue.

About your second question, in the command line, you can use -latex:nopreamble flag to remove some headers.
Is this what you are looking for ?

0 votes
answered Sep 20, 2018 by satas (140 points)
Hello,

this is a short example for how I would like to use math mode to generate latex files with math.

@startuml
start

:set $x = \sqrt{y+z}$ and $i = 1$;

end

@enduml

(how to put it in code environment here in the forum?)

Yes, for the dollar sign I would like to manually insert a backslash (which also does not work now, since it will be backslashed one more time).

I see also, that all the backslashes themselves are also replaced by \\ so this is also something which should be changed to allow better latex integration.

So basically the idea is to write the text in the same way one would in plain latex and just copy and paste it when using -tlatex option ;)

By the way, using <latex></latex> and produce a latex file results in the loss of this inserted math code.

The nopreamble was the thing I've asked for...
0 votes
answered Sep 20, 2018 by plantuml (294,960 points)

(how to put it in code environment here in the forum?)

You have to use the "formatted" style instead of "normal"

Last beta http://beta.plantuml.net/plantuml.jar gives a better result for :

@startuml
start
:a;
:<latex>set $x = \sqrt{y+z}$ and $i = 1$</latex>;
:b <latex>set $x = \sqrt{y+z}$ and $i = 2$</latex>;
end
@enduml

However we are going to have exactly the same problem we have for font size (see http://forum.plantuml.net/6495/wrong-class-widths-after-latex-export )

We're still working on it...

...