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

log Missing character message from bend decimal angle #700

Closed
kryde opened this issue Jun 26, 2019 · 6 comments
Closed

log Missing character message from bend decimal angle #700

kryde opened this issue Jun 26, 2019 · 6 comments
Assignees

Comments

@kryde
Copy link

kryde commented Jun 26, 2019

In recent Debian packaged PGF 3.1.1, a file

\documentclass[a4paper]{article}
\usepackage{tikz}
\begin{document}
\begin{tikzpicture}
\node (A) at (0,0) {A};
\node (B) at (15,0) {B};
\draw[bend left=0.9] (A) to (B);
\end{tikzpicture}
\end{document}

processed with "latex foo.tex" leaves in foo.log messages

Missing character: There is no . in font nullfont!
Missing character: There is no 9 in font nullfont!

This seems to be the .9 in the bend left. It seems decimals in such angle work correctly, but it could be good if the log was clean to them (or if it hints at anything fishy).

I struck this when some actual mistakes I'd made showed up in the log this way. I had bits like a stray semi in \draw ...; node[at end] ... so the "node" part did not take effect but gave Missing character n etc. Or a harmless bit like \foreach ... { }; where the final ; is unnecessary and likewise showed as Missing character.

@hmenke
Copy link
Member

hmenke commented Jun 26, 2019

Well spotted 👍 Fixed in 36803f7.

Meanwhile you can backport the fix using

\documentclass[a4paper]{article}
\usepackage{tikz}

\makeatletter

\tikzoption{bend left}[]{%
  \def\pgf@temp{#1}%
  \ifx\pgf@temp\pgfutil@empty%
  \else%
    \pgfmathsetmacro\tikz@to@bend{#1}%
  \fi%
  \let\tikz@to@out=\tikz@to@bend%
  \pgfmathsetmacro\tikz@to@in{180-\tikz@to@out}%
  \tikz@to@switch@on%
  \tikz@to@relativetrue%
}

\makeatother

\begin{document}
\begin{tikzpicture}
\node (A) at (0,0) {A};
\node (B) at (15,0) {B};
\draw[bend left=0.9] (A) to (B);
\end{tikzpicture}
\end{document}

@hmenke hmenke closed this as completed Jun 26, 2019
@hmenke
Copy link
Member

hmenke commented Jun 26, 2019

In LuaTeX you can also make the “Missing character” a hard error, so you don't have to rely on chance to look in the logfile. The following is one single file, but split into three code blocks because GitHub doesn't support mixed syntax highlighting.

\documentclass[a4paper]{article}
\usepackage{tikz}
\usepackage{luacode}
\begin{luacode}
local function glyph_error(id, char)
    local fontname = tex.fontname(tex.fontidentifier(id))
    local message = string.format(
        "Missing character: There is no %s (U+%04X) in font %s!",
        utf.char(char), char, fontname)
    tex.error(message)
end

luatexbase.add_to_callback("glyph_not_found", glyph_error, "glyph_error")
\end{luacode}
\begin{document}
\begin{tikzpicture}
\node (A) at (0,0) {A};
\node (B) at (15,0) {B};
\draw[bend left=0.9] (A) to (B);
\end{tikzpicture}
\end{document}

@hmenke hmenke self-assigned this Jun 26, 2019
@kryde
Copy link
Author

kryde commented Jun 26, 2019

Ah, beaut.

@stefanct
Copy link

stefanct commented Mar 28, 2022

uhm, but what about bend right though? asking for a diagram ;)
it has the same problem but the fix doesn't work (alone), i guess because of the code that negates the input?

Edit: In theory this works for bend right=x, but it breaks if bend right is used w/o a dimension/factor.

\tikzoption{bend right}[]{%
  \def\pgf@temp{#1}%
  \ifx\pgf@temp\pgfutil@empty%
  \else%
    \pgfmathsetmacro\tikz@to@bend{-#1}%
  \fi%
  \let\tikz@to@out=\tikz@to@bend%
  \pgfmathsetmacro\tikz@to@in{180-\tikz@to@out}%
  \tikz@to@switch@on%
  \tikz@to@relativetrue%
}

@muzimuzhi
Copy link
Member

@stefanct The latest code (since v3.1.6a) is different to what you shown, and it seems ok, see

\tikzoption{bend right}[]{%
\def\pgf@temp{#1}%
\ifx\pgf@temp\pgfutil@empty%
\else%
\pgfmathsetmacro\tikz@to@bend{#1}%
\fi%
% Now, negate
\pgfmathsetmacro\tikz@to@out{-(\tikz@to@bend)}
\pgfmathsetmacro\tikz@to@in{180-(\tikz@to@out)}
\tikz@to@switch@on%
\tikz@to@relativetrue%
}

An example will better demonstrate your problem.

@stefanct
Copy link

Right, because of 357bc05 thanks to #837. My installation is just too old and I fell for a github UI "feature", sorry for the noise.

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

No branches or pull requests

4 participants