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

Spaces missing in “divide by zero” error message #679

Closed
PhelypeOleinik opened this issue May 20, 2019 · 2 comments
Closed

Spaces missing in “divide by zero” error message #679

PhelypeOleinik opened this issue May 20, 2019 · 2 comments

Comments

@PhelypeOleinik
Copy link
Member

The code:

\documentclass{article}
\usepackage{tikz}
\begin{document}
\tikz \draw (1/0,0) -- (1,1);
\end{document}

produces the error message:

! Package PGF Math Error: You'veaskedmetodivide`1'by`0',butIcannotdivideanynumb
erby`0' (in '1/0').

See the PGF Math package documentation for explanation.
Type  H <return>  for immediate help.
 ...                                              
                                                  
l.4 \tikz \draw (1/0,0)
                        -- (1,1);
?

If I didn't know better I'd say someone loaded expl3 in PGF--TikZ ;-)

@josephwright
Copy link
Contributor

In a sense it is :) If you do a quick trace, you find

\pgfmath@declarefunction #1#2->\pgfmath@namedef {pgfmath@function@#1}{#1}\pgfma
th@namedef {pgfmath@operation@#1@type}{function}\pgfmath@namedef {pgfmath@opera
tion@#1@arity}{#2}\pgfmath@namedef {pgfmath@operation@#1@infix}{#1}\pgfmath@nam
edef {pgfmath@operation@#1@precedence}{1000}\expandafter \ifx \csname pgfmath@o
peration@#1@arity\endcsname \pgfmath@dots \pgfmath@namedef {pgfmath@operation@#
1@arity}{1}\else \ifnum \csname pgfmath@operation@#1@arity\endcsname >9\relax \
pgfmath@namedef {pgfmath@operation@#1@arity}{1}\fi \fi \edef \pgfmath@marshal {
\noexpand \pgfmath@@declarefunction {\expandafter \noexpand \csname pgfmath#1\e
ndcsname }{\expandafter \noexpand \csname pgfmath#1@\endcsname }{\csname pgfmat
h@operation@#1@arity\endcsname }}\begingroup \catcode `\	=9\relax \catcode `\ =
9\relax \catcode `\~=10\relax \endlinechar =`\ \relax \pgfmath@marshal 

which you'll see ends with setting space to ignore, ~ to a space and \endlinechar to a space.

hmenke added a commit that referenced this issue May 20, 2019
@hmenke hmenke self-assigned this May 20, 2019
@hmenke hmenke closed this as completed May 20, 2019
@pgf-tikz pgf-tikz deleted a comment May 20, 2019
@hmenke
Copy link
Member

hmenke commented May 22, 2019

BTW, this broke when fixing this #508

hmenke added a commit to hmenke/pgf that referenced this issue Jun 3, 2019
This reverts commit 0795962.

In addition to reverting 00f4e8d, this
has to be reverted as well, otherwise we will have spurious
\nobreakspace everywhere in the error messages.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Development

No branches or pull requests

3 participants