(已修复)使用 \tkzDefLine 创建垂直线时,如果使用带下划线的点名,会导致错误“缺少 $ 插入”

(已修复)使用 \tkzDefLine 创建垂直线时,如果使用带下划线的点名,会导致错误“缺少 $ 插入”

更新:该问题已在 tkz-euclide ver. 4.00 中修复。

原始帖子:

\documentclass{article}
\usepackage{tkz-euclide}
\begin{document}
\begin{tikzpicture}
  \tkzDefPoint(0,0){B}
  \tkzDefPoint(6,0){C}
  \tkzDefPoint(5,5){A_1}
  \tkzDrawPoints(A_1,B,C)
  \tkzDrawPolygon(A_1,B,C)
  \tkzLabelPoints(A_1,B,C)
  
  \tkzDefLine[orthogonal=through A_1](B,C)\tkzGetPoint{a} %no problem for "through A"
  %no problem for parallel option
  %\tkzDefLine[parallel=through A_1](B,C)\tkzGetPoint{a}
  %no problem for other macro
  %\tkzDefPointBy[inversion=center B through A_1](C)\tkzGetPoint{a}
  \tkzDrawSegment(A_1,a)
\end{tikzpicture}
\end{document}

我知道有办法避免这种情况,但由于这种用法不会给其他宏造成问题,所以这是一个错误吗?

答案1

我在代码中对 TikZ 和 tkz-euclide 有一些注释。

在此处输入图片描述

\documentclass[tikz,border=5mm]{standalone}
\usepackage{tkz-euclide}
\begin{document}
\begin{tikzpicture}
\tkzDefPoint(0,0){B}
\tkzDefPoint(5,0){C}
\tkzDefPoint(4,3.5){A1}
\tkzDrawPoints(A1,B,C)
\tkzDrawPolygon(A1,B,C)
\tkzLabelPoints(A1,B,C)
        

%\tkzDefLine[orthogonal=through A1] (B,C)    % <<< a blank syntax error
\tkzDefLine[orthogonal=through A1](B,C) 
\tkzGetPoint{M} 
\tkzDrawSegment(A1,M)


%\tkzDefLine[parallel=through A1] (B,C)     % <<< a blank syntax error
\tkzDefLine[parallel=through A1](B,C)
\tkzGetPoint{N}
\tkzDrawSegment(A1,N)


%\tkzDefPointBy[inversion=center B through A1] (C)   % <<< a blank syntax error
\tkzDefPointBy[inversion=center B through A1](C)
\tkzGetPoint{P}
\tkzDrawPoint(P)

%\tkzLabelPoints(P)                    % with `s`, it works
%\tkzLabelPoint(P)                    % without `s`, it does not work ^^
\tkzLabelPoint[right](P){$P$}        % without `s`, and label, it works again ^^
%\tkzLabelPoint[right] (P){$P$}        % without `s`, and label, and a blank, it doesnot works again ^^
\end{tikzpicture}

\usetikzlibrary{calc} 
\begin{tikzpicture}
\path
(0,0) coordinate (B) node[below left]{$B$}
(5,0) coordinate (C) node[below right]{$C$}
(4,3.5) coordinate (A) node[above right]{$A$}
($(A)+.3*(C)-.3*(B)$) coordinate (Ar)
($(A)-(C)+(B)$) coordinate (Al)
($(B)!(A)!(C)$) coordinate (H);

\draw (A)--(B)--(C)--cycle;
\draw[red] (Al)--(Ar);
\draw[blue,shorten >=-1cm,shorten <=-1cm] (A)--(H);
\foreach \p in {A,B,C}
\draw[fill=white] (\p) circle(1.5pt);
 
\end{tikzpicture}
\end{document}

在此处输入图片描述

相关内容