PGF/TiKZ bug

Lenore shared this problem 5 years ago
Solved

I'm attempting to repost this correctly as a bug.


The PGF/TiKZ export option is missing closing } in some cases and losses the tick-marks on the y-axis.


The incorrect code generated by

[co]GeoGebra 5.0.352.0-3D (03 April 2017)

Java: 1.8.0_20

Codebase: file:/Applications/GeoGebra%205.app/Contents/Resources/Java/

OS: Mac OS X

Architecture: x86_64 / null

is

attached as is a hand-corrected version that will actually compile and

produce a reasonably correct version of the ggb screen.

  • export for drawing axes is missing y-axis tick-marks because that line of code gives a point rather than a pair of points
  • In

    textbook (from toolbar) in ggb using LaTeX, multiple lines of equations

    require an explicit \\ typed into the dialog box. When those lines of

    equations are exported in TiKZ/PGF a redundant \\ is added.

  • When

    multiline LaTeX in a textbox (from the toolbar) is exported, the

    terminating $ setting off the equations as math inside the TiKZ/PGF node

    is inside the last } of the math expression and the entire node is

    lacking the closing }. (The last } on the line actually closes the

    parbox.) This last pair of errors is what causes the failure to

    compile. Sadly, it causes TiKZ/PGF to complain about subsequent \draw

    statements so it's a bit painful to debug, but that's not ggb's fault.

Well,

I tried attaching files, but I can't see that anything is happening.

There may be two copies of each, in which case the second errors file is

the real one. So I guess I'll just quote excerpts here.

y-axis is:

\draw[shift={(0,\y)},color=black] (-2pt,0pt) node[left] {\footnotesize $\y$};

y-axis should be:

\draw[shift={(0,\y)},color=black] (-2pt,0pt) -- (2pt,0pt) node[left] {\footnotesize $\y$};

a block of equations is:

\draw

(38.02668824248539,15.782488764428555) node[anchor=north west]

{\parbox{23.339053270351926 cm}{$\vec{F}_R=I\vec{L}\times\vec{B} \\ \\

\vec{F}_R=IHB(-\hat{y})\times(-\hat{z}) \\ \\ \vec{F}_R=IHB\hat{x$}};

the same block of equations should be:

\draw

(38.02668824248539,15.782488764428555) node[anchor=north west]

{\parbox{23.93081627089105 cm}{$\vec{F}_R=I\vec{L}\times\vec{B} \\

\vec{F}_R=IHB(-\hat{y})\times(-\hat{z}) \\ \vec{F}_R=IHB\hat{x}$}};

So

maybe it's the closing } on the final \hat that is missing, but the

other \hat instances have both {}. In any case, what is currently being

output doesn't work.

Comments (7)

photo
1

Please can you attach:

* ggb file

* faulty code

* corrected code?

photo
1

I generated FaultyCode.txt with the scale set to 0.2cm in each direction. I generated FaultyCode2.txt with the default value for the scale. Note that in the latter case, the tick-marks on the y-axis are not drawn because the second point is never given.

photo
1

Thanks, all fixed for the next release!

photo
1

Thanks for the speedy solution.

photo
1

Please try the new version 5.0.357.0

photo
1

How? Mac App Store is at 5.0.355, https://wiki.geogebra.org/e... is at 5.0.356.

photo
1

I found .361 finally and at least that particular file is fixed in .361. I haven't tried other files. Thanks again.

© 2023 International GeoGebra Institute