使用 Tkz-Euclide 包时不理解错误代码

使用 Tkz-Euclide 包时不理解错误代码

我收到以下错误:

(/usr/local/texlive/2022/texmf-dist/tex/latex/latexconfig/epstopdf-sys.cfg))
Missing character: There is no I in font nullfont!
Missing character: There is no ] in font nullfont!
Missing character: There is no ( in font nullfont!
Missing character: There is no O in font nullfont!
./Internal and external with nodes.tex:18: Use of \tkz@DefLine doesn't match it
s definition.
\pgfutil@ifnextchar ...1\def \pgfutil@reserved@a {
                                                  #2}\def \pgfutil@reserved@...
l.18 ...wSegments[add = .5 and .5, new](D,D' E,E')./Internal and external with nodes.tex:18: Argument of \tikz@path@overlayed has
 an extra }.
<inserted text> 
                \par 
l.18 ...wSegments[add = .5 and .5, new](D,D' E,E')
                                              

当尝试渲染该图表时,我无法判断哪里出了问题,因为它直接来自手册,我是不是做了一些愚蠢的事情?

\documentclass{article} 
\usepackage{xcolor} 
\usepackage{tkz-euclide} 


\begin{document}

\begin{tikzpicture}[scale=0.75]
    \tkzDefPoints{0/0/O,4/-5/A,3/0/B,5/-5/C}
    \tkzDefSimilitudeCenter[int](O,B)(A,C)  \tkzGetPoint{I}
    \tkzDefSimilitudeCenter[ext](O,B)(A,C)  \tkzGetPoint{J}
    \tkzDefLine[tangent from = I] (O,B)         \tkzGetPoints{D}{E}
    \tkzDefLine[tangent from = I] (A,C)         \tkzGetPoints{D'}{E'}
    \tkzDefLine[tangent from = J] (O,B)         \tkzGetPoints{F}{G}
    \tkzDefLine[tangent from = J] (A,C) 
    \tkzGetPoints{F'}{G'}
    \tkzDrawCircles(O,B A,C)
    \tkzDrawSegments[add = .5 and .5, new](D,D' E,E')
    \tkzDrawSegments[add = 0 and 0.25, new](J,F J,G)
    \tkzDrawPoints(O,A,I,J,D,E,F,G,D',E',F',G')
\end{tikzpicture}

\end{document}

有人能帮我理解错误信息以便修复吗?谢谢

答案1

\documentclass[border=1cm]{standalone}
\usepackage{xcolor} 
\usepackage{tkz-euclide} 
\begin{document}
    
\begin{tikzpicture}[scale=0.75]
\tkzSetUpStyle[color=orange,line width=.2pt]{new}
\tkzDefPoints{0/0/O,4/-5/A,3/0/B,5/-5/C}
\tkzDefSimilitudeCenter[int](O,B)(A,C)   \tkzGetPoint{I}
\tkzDefSimilitudeCenter[ext](O,B)(A,C)   \tkzGetPoint{J}
\tkzDefLine[tangent  from=I](O,B)        \tkzGetPoints{D}{E}
\tkzDefLine[tangent from=I](A,C)         \tkzGetPoints{D'}{E'}
\tkzDefLine[tangent from=J](O,B)         \tkzGetPoints{F}{G}
\tkzDefLine[tangent from=J](A,C)         \tkzGetPoints{F'}{G'}
\tkzDrawCircles(O,B A,C)
\tkzDrawSegments[add = .5 and .5,new](D,D' E,E')
\tkzDrawSegments[add = 0 and 0.25](J,F J,G)
\tkzDrawPoints(O,A,I,J,D,E,F,G,D',E',F',G')
\end{tikzpicture}
\end{document}
  1. ]就像斯科特写的,在和之间没有空格(

  2. 你需要定义风格new

  3. 我不明白有关结果的评论,因为使用 4.25 版本(最新版本)我得到的结果与我的文档相同。

在此处输入图片描述

答案2

以下内容对我来说编译得很好(删除一些空格后),并且new文档中未定义的键。特别是我删除了

\tkzDefLine[tangent from = I] (O,B)

命令。 话虽如此,输出看起来与文档中完全不同,所以我不知道到底发生了什么。

new当我第一次浏览文档时,我花了一段时间才弄清楚它是什么。它在 p32 上定义为:

\tkzSetUpStyle[color=orange,line width=.2pt]{new}

因此,如果您愿意的话,您可以将其添加到您的文档中。

\documentclass{article} 
\usepackage{xcolor} 
\usepackage{tkz-euclide} 


\begin{document}

\begin{tikzpicture}[scale=0.75]
    \tkzDefPoints{0/0/O,4/-5/A,3/0/B,5/-5/C}
    \tkzDefSimilitudeCenter[int](O,B)(A,C)  \tkzGetPoint{I}
    \tkzDefSimilitudeCenter[ext](O,B)(A,C)  \tkzGetPoint{J}
    \tkzDefLine[tangent from=I](O,B)         \tkzGetPoints{D}{E}
    \tkzDefLine[tangent from=I](A,C)         \tkzGetPoints{D'}{E'}
    \tkzDefLine[tangent from=J](O,B)         \tkzGetPoints{F}{G}
    \tkzDefLine[tangent from=J](A,C) 
    \tkzGetPoints{F'}{G'}
    \tkzDrawCircles(O,B A,C)
    \tkzDrawSegments[add = .5 and .5](D,D' E,E')
    \tkzDrawSegments[add = 0 and 0.25](J,F J,G)
    \tkzDrawPoints(O,A,I,J,D,E,F,G,D',E',F',G')
\end{tikzpicture}

\end{document}

答案3

该命令\tkzDefLine定义为

\def\tkzDefLine{\pgfutil@ifnextchar[{\tkz@DefLine}{\tkz@DefLine[]}}
\def\tkz@DefLine[#1](#2){% 
\begingroup
%\pgfkeys{/tkzdefline/.cd,K=1}  
\pgfqkeys{/tkzdefline}{#1}  
\ifcase\tkz@numline%
 % first case 0
 \tkzDefMediatorLine(#2)  
  \or% 1
  \tkzDefOrthLine[\tkz@koeff](#2)
  \or% 2
   \tkzDefLineLL(#2)
  \or% 3
  \tkzDefBisectorLine(#2)
  \or% 4
  \tkzDefBisectorOutLine(#2)
  \or% 5
  \tkzDefSymmedianLine(#2)
    \or% 6
  \tkzDefAltitudeLine(#2)
  \or% 7
   \tkzDefEulerLine(#2)
   \or% 8
   \tkzTgtFromP(#2)(\tkz@ptfrom)
 \or% 9
   \tkzTgtAt(#2)(\tkz@ptat)
  \fi    
\endgroup
}

TeX 正在等待参数(之后的内容,如果在它们之间添加空格则会导致错误。]\tkzDefLine

解决方案是更改\tkz@DefLine命令并\pgfutil@ifnextchar(在命令后添加以忽略]和之间的任何空格(

\documentclass{article} 
\usepackage{xcolor} 
\usepackage{tkz-euclide} 

\tikzset{new/.style={color=orange,line width=.2pt}}

\makeatletter

\def\tkzDefLine{\pgfutil@ifnextchar[{\tkz@DefLine}{\tkz@DefLine[]}}
\def\tkz@DefLine[#1]{%
  \pgfutil@ifnextchar(%)
    {\tkz@Def@Line{#1}}
    {\ERROR}%
}

\def\tkz@Def@Line#1(#2){% 
\begingroup
%\pgfkeys{/tkzdefline/.cd,K=1}  
\pgfqkeys{/tkzdefline}{#1}  
\ifcase\tkz@numline%
 % first case 0
 \tkzDefMediatorLine(#2)  
  \or% 1
  \tkzDefOrthLine[\tkz@koeff](#2)
  \or% 2
   \tkzDefLineLL(#2)
  \or% 3
  \tkzDefBisectorLine(#2)
  \or% 4
  \tkzDefBisectorOutLine(#2)
  \or% 5
  \tkzDefSymmedianLine(#2)
    \or% 6
  \tkzDefAltitudeLine(#2)
  \or% 7
   \tkzDefEulerLine(#2)
   \or% 8
   \tkzTgtFromP(#2)(\tkz@ptfrom)
 \or% 9
   \tkzTgtAt(#2)(\tkz@ptat)
  \fi    
\endgroup
}

\makeatother


\begin{document}

\begin{tikzpicture}[scale=0.75]
    \tkzDefPoints{0/0/O,4/-5/A,3/0/B,5/-5/C}
    \tkzDefSimilitudeCenter[int](O,B)(A,C)  \tkzGetPoint{I}
    \tkzDefSimilitudeCenter[ext](O,B)(A,C)  \tkzGetPoint{J}
    \tkzDefLine[tangent from = I] (O,B)  \tkzGetPoints{D}{E}
    \tkzDefLine[tangent from = I] (A,C)  \tkzGetPoints{D'}{E'}
    \tkzDefLine[tangent from = J] (O,B)  \tkzGetPoints{F}{G}
    \tkzDefLine[tangent from = J] (A,C)  \tkzGetPoints{F'}{G'}
    \tkzDrawCircles(O,B A,C)
    \tkzDrawSegments[add = .5 and .5,new](D,D' E,E')
    \tkzDrawSegments[add = 0 and 0.25,new](J,F J,G)
    \tkzDrawPoints(O,A,I,J,D,E,F,G,D',E',F',G')
\end{tikzpicture}

\end{document}

相关内容