LaTex: little bug when processing annotations (missing space at "<")

0 votes
asked Apr 8 in Bug by zechenhund (120 points)

When processing annotations to lines in state diagrams, the LaTeX-driver seems to have a bug when handling space around symbols like "<": 

  • "v_act <= 1.00 * v_max [0]" is treated correctly
  • "v_act >  1.00 * v_max [0]" has a space missing between > and 1.00

It's a tiny bug, but it's a bit ugly in the layout. 

Regards,
zechenhund

Example:

' BangBang-Steuerung als primitivst mögliche Steuerung. 

'

@startuml

legend "BangBang"

footer 2021/03/06 15:45 - GFB

hide empty description

@startuml

state HAB {

[*]  -u-> Halt : Aufrüsten

Halt -d-> [*] : Abrüsten

state Driving {

Accel -r-> Break : v_act >  1.00 * v_max [0]

Break -l-> Accel : v_act <= 1.00 * v_max [0]

}

Halt  -u-> Accel : Abfahrauftrag\n//(MA received)//

Break -d-> Halt : Ankunft\n//(arrival at EoA)//

}

@enduml

Version: PlantUML version 1.2021.3

PDF output via -tlatex shows space missing.

In PNG generated via -tpng the spaces appear correctly.  

1 Answer

0 votes
answered Apr 8 by plantuml (252,860 points)

Thanks for the report.

If you edit manually the LaTeX result, you should see that "v_act >  1.00" is transformed to "v\_act \textgreater   1.00".

Can you confirm ?

commented Apr 9 by zechenhund (120 points)

Thanks for the quick (or rather: immediate) answer!

Yes, I can confirm. In particular, I see 

{v\_act \textless = 1.20 * v\_max [1]};
{v\_act  \textgreater  1.20 * v\_max [1]};

It's not clear why \textgreater has 2 spaces on both sides, while \textless has only 1 on both sides. This, however, is not the cause of the discrepancy observed. Instead, \textless is followed immediately by "=" which is itself separated from "1.20" by a space, and this gets transported into the LaTeX-code. \textgreater is followed by spaces which, from the point of view of LaTeX, is just the space terminating the command "\textgreater", and no extra space gets transported into LaTeX-code. To have a space separating ">" from "1.20", one would need an additional space ("\_ " or "\quad" or "\em" or similar) after "\textgreater". 

However, this explains why there is no straightforward and easily implemented fix for this. Always adding an extra space by "\ " or such would break the case "\textless =" by separating the "<" from "=". (Not without further parsing of the text and translating it into more elaborate LaTeX-code like "\leq", which is certainly not what one wants to do here.)

Therefore, I conclude that this should not be fixed but left as is - we just have to cope whit it. 

Thanks a lot for your effort in providing this!

zechenhund

commented Apr 9 by zechenhund (120 points)

By the way, there is another little bug: When adding 

state any #line.dotted

the "#line.dotted" is not honored by the LaTeX-output: the border of state "any" is still drawn as a solid line. When deleting "hide empty description" the inner separator line is correctly drawn as dotted, while the outer border line continues to be drawn as solid. 

commented Apr 9 by zechenhund (120 points)

And again: there is a similar but different behaviour generating PNG. 

With state any #line.dotted and hide empty description inactive the outer border and the inner separator of "any" are drawn dotted. With hide empty description active the outer border is now drawn solid. 

I will now shut up - over and out!  wink

...