Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

TikZ DECORATE incorrectly fails with "Dimension too large." using MiKTeX and TeX Live 2022 #1297

Open
aendie opened this issue Dec 6, 2023 · 4 comments

Comments

@aendie
Copy link

aendie commented Dec 6, 2023

Brief outline of the bug

I posted an issue on TEX Stack Exchange with the same title but was unable to upload the four .tex files so that someone can reproduce the problem and verify that it is data-related and thus needs investigation:

https://tex.stackexchange.com/questions/703322/tikz-decorate-incorrectly-fails-with-dimension-too-large-using-miktex-and-tex

Please excuse me for adding them here. As already stated, the TikZ decorate function on line 1022 for latitude 62.0°N fails with MiKTeX 23.10.12 on Windows and TeX Live 2022 on Ubuntu on the same hardware and also on an older Windows laptop:

test case 62°N.zip

The test case with very similar data for 61.9°N works perfectly:

test case 61.9°N.zip

Also the test case for 62.1°N works perfectly:

test case 62.1°N.zip

And the test case for 62°N works when four decimal places are used for the coordinates instead of three:

test case 62°N with 4 decimal places.zip

I maintain that this proves that the "Dimension too large" error is incorrect and that the error is data-related, which it obviously shouldn't be.

The MWE that fails (a Minimum non-Working Example) is below. Workaround: Comment out the DeclareUnicodeCharacter line and it runs successfully ..... though I do not see this as a solution to the problem for various reasons. Apologies for the external link as I originally intended to post the whole topic in TEX StackExchange and only come here if it is seen as an issue.

Minimal working example (MWE)

\pdfminorversion=4
\documentclass[10pt, a4paper,landscape]{report}
\usepackage[utf8]{inputenc}
\usepackage[top=5mm, bottom=5mm, left=2mm, right=2mm]{geometry}
\usepackage{tikz} % for \draw (load after 'graphicx')
\usetikzlibrary{decorations.text} % to print text on a curve
\DeclareUnicodeCharacter{00B0}{\ensuremath{{}^\circ}}
\begin{document}
\newcommand*{\PMstyle}{\sffamily\normalsize\color{blue}}
\begin{tikzpicture}
% decorate PM dusk with text aligned left
\path [decorate,decoration={text along path,raise=-2.4ex,text align={left indent=1.112cm},text={|\PMstyle|D U S K~~~at latitude 62.0{°}N~~~(Sun 6{°} below horizon)}}]
plot[smooth,tension=0.5] coordinates{
(0.000, 10.982) (0.347, 11.067) (0.695, 11.170) (1.042, 11.287) (1.390, 11.417)
(1.738, 11.555) (2.085, 11.699) (2.433, 11.848) (2.780, 11.999) (3.127, 12.152)
(3.475, 12.306) (3.822, 12.461) (4.170, 12.616) (4.518, 12.771) (4.865, 12.927)
(5.212, 13.085) (5.560, 13.244) (5.907, 13.406) (6.255, 13.572) (6.602, 13.741)
(6.950, 13.915) (7.297, 14.096) (7.645, 14.283) (7.992, 14.478) (8.340, 14.683)
(8.688, 14.898) (9.035, 15.126) (9.382, 15.371) (9.730, 15.641) (10.077, 15.958)
(10.425, 16.477) };
\end{tikzpicture}
\end{document}

@ilayn
Copy link
Member

ilayn commented Dec 6, 2023

A couple of quick points;

  • The dimension too large is data dependent. If decorations are used in tight places then you will get errors. The typical source for this error is when decoration angle computations overflow if things get too steep; atan2 overflows while trying to get angle. Or bunch of things can overflow. Hence this is almost always a data issue. Because TeX works with a fixed point arithmetic and it is very easy to saturate the precision

  • You are asking folks to download zip files from unknown sources. That's a security risk. Either spend the time to demonstrate things in a minimal fashion or paste your file to overleaf or whichever service so we can also have a look. So the ball is on your side regarding your last sentence.

  • Please refrain from creating fake ethical dilemmas. That's a very tasteless style on forcing people to respond to you. We could and would close the issue if we see fit.

Here are first hits from Google

https://tex.stackexchange.com/questions/195030/tikz-decorated-paths-and-fixedpointarithmetic-library

https://tex.stackexchange.com/questions/170595/tikz-decorations-markings-cause-dimension-too-large

https://tex.stackexchange.com/questions/522074/tikz-decorate-stroke-thickness-throws-dimenson-too-large-but-looks-fine-ditt

@davidcarlisle
Copy link
Member

Please follow the bug report template

https://github.com/pgf-tikz/pgf/issues/new?assignees=&labels=&projects=&template=bug_report.yml

which here, as at stackexchange, requires a minimal example demonstrating the issue.

@hmenke
Copy link
Member

hmenke commented Dec 8, 2023

Remove smooth from the plot command and you're good.

@aendie
Copy link
Author

aendie commented Dec 8, 2023

Henri, your feedback is highly appreciated and coming from you I believe this will work in all cases. Many, many thanks for your assistance. As Till Tantau writes on the second page of the TikZ & PGF Manual: "Für meinen Vater, damit er noch viele schöne TEX-Graphiken erschaffen kann", I too am creating beautiful charts with TikZ and am humbly grateful that such a masterpiece was created for creative programmers. THANK YOU.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

No branches or pull requests

4 participants