2

I have another question similar to my last question about 2018 -> 2020 tkz-euclide compatibility changes.

I have a circle diagram that compiles and renders perfectly in Overleaf (TeX Live 2018):

enter image description here

Here is the code that compiles successfully:

\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}

However if you change the TeX Live distribution from 2018 to 2020, it renders differently and Overleaf spits some errors:

enter image description here

enter image description here

I learned from this thread that \usetkzobj{all} shouldn't be used with recent tkz-euclide. Commenting this line in the 2020 distribution fixes some but not all issues.

Some (undesired changes):

  1. In 1st diagram, geometric points are very large
  2. In 1st diagram, angles have a "tick mark" in them
  3. In 2nd diagram, tangent lines to circle disappeared

Any ideas how to fix these issues? Thank you!

1 Answer 1

2

First of all \usetkzobj{all} should be removed, in the new version it gives an error. (Sorry, didn't see you had mentioned that, but it wasn't commented out in the code.)

Second, \tkzTangent should be \tkzDefTangent

That fixes the errors. For the undesired changes:

  1. if the dots are too large, just change the size in \tkzDrawPoints[fill=black,size=10](O,A,B,C), e.g. size=5.
  2. Default behaviour of \tkzMarkAngle
  3. See \tkzDefTangent above.

Complete code:

enter image description here

\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}
1
  • Thank you! You solved all my issues :) Nov 16, 2020 at 1:35

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .