![使用 tkz-euclide 制作的圆形图在 TeX Live 2018 和 TeX Live 2020 中的呈现方式不同](https://linux22.com/image/423958/%E4%BD%BF%E7%94%A8%20tkz-euclide%20%E5%88%B6%E4%BD%9C%E7%9A%84%E5%9C%86%E5%BD%A2%E5%9B%BE%E5%9C%A8%20TeX%20Live%202018%20%E5%92%8C%20TeX%20Live%202020%20%E4%B8%AD%E7%9A%84%E5%91%88%E7%8E%B0%E6%96%B9%E5%BC%8F%E4%B8%8D%E5%90%8C.png)
我还有另一个类似的问题我最后一个问题关于 2018 -> 2020tkz-euclide
兼容性变化。
我有一个圆形图,可以在 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 Find:
%from https://latex.org/forum/viewtopic.php?t=23290
\begin{center}
\begin{tikzpicture}
\tkzDefPoint[label=above:O](0:0){O}
\tkzDefPoint[label=below left:A](230:2){A}
\tkzDefPoint[label=below right:B](310:2){B}
\tkzDefPoint[label=above:C](90:2){C}
\tkzDrawPoints[fill=black,size=10](O,A,B,C)
\tkzDrawCircle(O,A)
\tkzDrawPolygon(C,A,O,B)
\tkzMarkAngle[size=0.75](A,O,B)
\tkzLabelAngle[pos=0.5,font=\small](A,O,B){80\degree}
\tkzMarkAngle[size=0.75](A,C,B)
\tkzLabelAngle[pos=0.5,font=\small](A,C,B){$\alpha$}
\end{tikzpicture}
\end{center}
\vspace*{\stretch{1}}
\part Evaluate the unknown arc and angle measures.
\begin{center}
\begin{tikzpicture}[scale=2] %from https://latex.org/forum/viewtopic.php?t=21949
\tkzDefPoint (0,0){O}
\tkzDefPoint (2,0){P}
\tkzDefPoint (1,0){C}
\tkzLabelPoint[left](O){$O$}
\tkzLabelPoint[right](P){$P$}
\tkzLabelPoint[right](C){$C$}
\tkzDrawCircle[R](O,1cm)
\tkzTangent[from with R=P](O,1cm) \tkzGetPoints{T1}{T2}
\tkzDrawLines[add=0 and 0](O,T1 O,T2 O,P)
\tkzDrawLines[add=0 and 0.5](P,T1 P,T2)
\tkzLabelPoint[above](T1){$A$}
\tkzLabelPoint[below](T2){$B$}
\tkzDrawArc[R with nodes,](P,0.5)(T1,T2)
%\draw (T1) node[above right] {$P(\alpha)=(a\,\cos\alpha,a\,\sin\alpha)$};
%\draw (T2) node[below right] {$Q(\alpha)=(a\,\cos\beta,a\,\sin\beta)$};
\draw (P) +(165:0.6) node {$25\degree$};
%\draw (P) +(195:0.6) node {$25\degree$};
\tkzLabelSegment[above right](O,A){$6$ cm}
\end{tikzpicture}
\end{center}
\vspace*{\stretch{1}}
\end{parts}
\end{questions}
\end{document}
但是,如果你将 TeX Live 发行版从 2018 更改为 2020,它的渲染方式会有所不同,并且 Overleaf 会出现一些错误:
我从中学到此主题不应\usetkzobj{all}
与最新的 tkz-euclide 一起使用。在 2020 发行版中注释此行可修复部分问题,但并非全部问题。
一些(不希望的改变):
- 在第一张图中,几何点非常大
- 在第一张图中,角度中有一个“刻度标记”
- 在第二张图中,圆的切线消失了
有什么办法可以解决这些问题吗?谢谢!
答案1
首先\usetkzobj{all}
应该删除,在新版本中它会出现错误。(抱歉,没看到你提到过这一点,但它没有在代码中被注释掉。)
第二,\tkzTangent
应该\tkzDefTangent
这样就修复了错误。对于不需要的更改:
- 如果点太大,只需更改大小
\tkzDrawPoints[fill=black,size=10](O,A,B,C)
,例如size=5
。 - \tkzMarkAngle 的默认行为
- 往上看
\tkzDefTangent
。
完整代码:
\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}
\tikzset{/tkzmkangle/mark=none} % https://tex.stackexchange.com/a/544732
%\usetkzobj{all} % <-- don't use this with the new version
%\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 Find:
%from https://latex.org/forum/viewtopic.php?t=23290
\begin{center}
\begin{tikzpicture}
\tkzDefPoint[label=above:O](0:0){O}
\tkzDefPoint[label=below left:A](230:2){A}
\tkzDefPoint[label=below right:B](310:2){B}
\tkzDefPoint[label=above:C](90:2){C}
\tkzDrawPoints[fill=black,size=5](O,A,B,C)
\tkzDrawCircle(O,A)
\tkzDrawPolygon(C,A,O,B)
\tkzMarkAngle[size=0.75](A,O,B)
\tkzLabelAngle[pos=0.5,font=\small](A,O,B){80\degree}
\tkzMarkAngle[size=0.75](A,C,B)
\tkzLabelAngle[pos=0.5,font=\small](A,C,B){$\alpha$}
\end{tikzpicture}
\end{center}
\vspace*{\stretch{1}}
\part Evaluate the unknown arc and angle measures.
\begin{center}
\begin{tikzpicture}[scale=2] %from https://latex.org/forum/viewtopic.php?t=21949
\tkzDefPoint (0,0){O}
\tkzDefPoint (2,0){P}
\tkzDefPoint (1,0){C}
\tkzLabelPoint[left](O){$O$}
\tkzLabelPoint[right](P){$P$}
\tkzLabelPoint[right](C){$C$}
\tkzDrawCircle[R](O,1cm)
\tkzDefTangent[from with R=P](O,1cm) \tkzGetPoints{T1}{T2}
\tkzDrawLines[add=0 and 0](O,T1 O,T2 O,P)
\tkzDrawLines[add=0 and 0.5](P,T1 P,T2)
\tkzLabelPoint[above](T1){$A$}
\tkzLabelPoint[below](T2){$B$}
\tkzDrawArc[R with nodes,](P,0.5)(T1,T2)
%\draw (T1) node[above right] {$P(\alpha)=(a\,\cos\alpha,a\,\sin\alpha)$};
%\draw (T2) node[below right] {$Q(\alpha)=(a\,\cos\beta,a\,\sin\beta)$};
\draw (P) +(165:0.6) node {$25\degree$};
%\draw (P) +(195:0.6) node {$25\degree$};
\tkzLabelSegment[above right](O,A){$6$ cm}
\end{tikzpicture}
\end{center}
\vspace*{\stretch{1}}
\end{parts}
\end{questions}
\end{document}