使用 tkz-euclide 制作的三角图可以在 TeX Live 2018 中渲染,但不能在 2020 中渲染

使用 tkz-euclide 制作的三角图可以在 TeX Live 2018 中渲染,但不能在 2020 中渲染

我有一个三角形图,可以在 Overleaf(TeX Live 2018)中完美编译和渲染:

在此处输入图片描述

以下是编译成功的代码:

\documentclass[addpoints]{exam}
\printanswers
\usepackage{gensymb} %for degree symbol
\usepackage{pgf,tikz}
\usetikzlibrary{angles,arrows.meta,automata,backgrounds,calc,decorations.markings,decorations.pathreplacing,intersections,patterns,positioning,quotes}
\usetikzlibrary{shapes} %For polygon nodes, see http://www.texample.net/tikz/examples/node-shapes/
\usepgflibrary{shapes.geometric}

%Needed to resolve conflict between tkz-euclide and thmtools, see https://tex.stackexchange.com/questions/456029/thmtools-and-tkz-euclide-conflict
\usepackage{tkz-euclide}
\usetkzobj{all}
%\usepackage{thmtools}
\usepackage{etoolbox}
\makeatletter
%%% patch tkz-tools-base.tex
\let\tkz@g@xa\tkz@init@xmin % don't undef \@xa or thmtools will be upset
\let\tkz@g@xb\tkz@init@xmax\undef\@xb
\let\tkz@g@ya\tkz@init@ymin\undef\@ya
\let\tkz@g@yb\tkz@init@ymax\undef\@yb
\patchcmd{\tkz@Init}
 {\global\let\@xa\tkz@init@xmin
  \global\let\@xb\tkz@init@xmax
  \global\let\@ya\tkz@init@ymin
  \global\let\@yb\tkz@init@ymax}
 {\global\let\tkz@g@xa\tkz@init@xmin
  \global\let\tkz@g@xb\tkz@init@xmax
  \global\let\tkz@g@ya\tkz@init@ymin
  \global\let\tkz@g@yb\tkz@init@ymax}
 {}{}
\patchcmd{\tkz@Grid}
 {(\@xa,\@ya)(\@xb,\@yb)}
 {(\tkz@g@xa,\tkz@g@ya)(\tkz@g@xb,\tkz@g@yb)}
 {}{}
\makeatother
\newtheorem{thm}{Theorem}

\title{MWE}
\begin{document}
\begin{questions}
\question
\begin{parts}
\part %from https://tex.stackexchange.com/questions/314290/how-to-draw-a-triangle-with-line-parallel-inside
$\triangle ABC$ to $\triangle ADE$
\begin{center}
\begin{tikzpicture}[scale=0.5]
\tkzDefPoint(0,0){A}
\tkzDefPoint(12,0){D}
\tkzDefPoint(12,6){E}
\tkzLabelPoint[below right](D){$D$}
\tkzLabelPoint[above right](E){$E$}
\tkzLabelPoint[below left](A){$A$}
\begin{pgfinterruptboundingbox}
\tkzDrawSegment(A,D)
\tkzDrawSegment(A,E)
\tkzDrawSegment(D,E)
\tkzDefPoint(9,4.5){C}
\tkzDefMidPoint(A,E)\tkzGetPoint{C}
\tkzDrawAltitude(A,D)(C)\tkzGetPoint{B}
\tkzLabelPoint[above](C){$C$}
\tkzLabelPoint[below](B){$B$}
\tkzLabelSegment[right](B,C){$y_1$}
\tkzLabelSegment[right](D,E){$y_2$}
\tkzLabelSegment[below](A,B){$x_1$}
\tkzLabelSegment[below](B,D){$x_2$}
\tkzLabelSegment[above](A,C){$z_1$}
\tkzLabelSegment[above](C,E){$z_2$}
\tkzMarkRightAngle[size=0.75,opacity=.4](A,B,C)
\tkzMarkRightAngle[size=0.75,opacity=.4](A,D,E)
\draw[{Bar[width=3mm].Latex[]}-{Latex[]Bar[width=3mm]}]($(D)-(0,1.5)$) -- node [fill=white] {$l$} ($(A)-(0,1.5)$);
\end{pgfinterruptboundingbox}
%\draw (current bounding box.south east) rectangle (current bounding box.north west);
\end{tikzpicture}
\end{center}
\vspace*{\stretch{1}}
\end{parts}
\end{questions}
\end{document}

但是,如果将 TeX Live 发行版从 2018 更改为 2020,它会破坏图表并无法渲染:

在此处输入图片描述

在此处输入图片描述

我从中学到此主题不应\usetkzobj{all}与最新的 tkz-euclide 一起使用。在 2020 发行版中注释此行可修复部分问题,但并非全部问题。

以下是我的 Overleaf 项目的链接,希望对您有帮助:

背面 MWE

您可以尝试通过转到菜单 > TeX Live 来更改版本,然后查看会发生什么。(\usetkzobj{all}如果您将 TeX Live 切换到 2018,请记住取消注释,否则图表将无法正确呈现。)

有什么想法可能导致不兼容吗?谢谢!

答案1

\tkzDrawXXXX 的语法似乎已更改,这会影响您的\tkzDrawAltitude。此处编译:

\documentclass{article}
\usepackage{tkz-euclide}
\begin{document}
\begin{tikzpicture}[scale=0.5]
\tkzDefPoint(0,0){A}
\tkzDefPoint(12,0){D}
\tkzDefPoint(12,6){E}
\tkzLabelPoint[below right](D){$D$}
\tkzLabelPoint[above right](E){$E$}
\tkzLabelPoint[below left](A){$A$}
\begin{pgfinterruptboundingbox}
\tkzDrawSegment(A,D)
\tkzDrawSegment(A,E)
\tkzDrawSegment(D,E)
\tkzDefPoint(9,4.5){C}
\tkzDefMidPoint(A,E)\tkzGetPoint{C}
\tkzDrawAltitude(A,C,D)%<--- changed
\tkzGetPoint{B}
\tkzLabelPoint[above](C){$C$}
\tkzLabelPoint[below](B){$B$}
\tkzLabelSegment[right](B,C){$y_1$}
\tkzLabelSegment[right](D,E){$y_2$}
\tkzLabelSegment[below](A,B){$x_1$}
\tkzLabelSegment[below](B,D){$x_2$}
\tkzLabelSegment[above](A,C){$z_1$}
\tkzLabelSegment[above](C,E){$z_2$}
\tkzMarkRightAngle[size=0.75,opacity=.4](A,B,C)
\tkzMarkRightAngle[size=0.75,opacity=.4](A,D,E)
\draw[{Bar[width=3mm].Latex[]}-{Latex[]Bar[width=3mm]}]($(D)-(0,1.5)$) -- node [fill=white] {$l$} ($(A)-(0,1.5)$);
\end{pgfinterruptboundingbox}
%\draw (current bounding box.south east) rectangle (current bounding box.north west);
\end{tikzpicture}
\end{document}

相关内容