TransWikia.com

Circle diagram made with tkz-euclide renders differently in TeX Live 2018 versus TeX Live 2020

TeX - LaTeX Asked by Mathemanic on December 31, 2020

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
lettkz@g@xatkz@init@xmin % don't undef @xa or thmtools will be upset
lettkz@g@xbtkz@init@xmaxundef@xb
lettkz@g@yatkz@init@yminundef@ya
lettkz@g@ybtkz@init@ymaxundef@yb
patchcmd{tkz@Init}
 {globallet@xatkz@init@xmin
  globallet@xbtkz@init@xmax
  globallet@yatkz@init@ymin
  globallet@ybtkz@init@ymax}
 {globallettkz@g@xatkz@init@xmin
  globallettkz@g@xbtkz@init@xmax
  globallettkz@g@yatkz@init@ymin
  globallettkz@g@ybtkz@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){80degree}
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,cosalpha,a,sinalpha)$};
%draw (T2) node[below right] {$Q(alpha)=(a,cosbeta,a,sinbeta)$};
draw (P) +(165:0.6) node {$25degree$};
%draw (P) +(195:0.6) node {$25degree$};
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!

One Answer

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
lettkz@g@xatkz@init@xmin % don't undef @xa or thmtools will be upset
lettkz@g@xbtkz@init@xmaxundef@xb
lettkz@g@yatkz@init@yminundef@ya
lettkz@g@ybtkz@init@ymaxundef@yb
patchcmd{tkz@Init}
 {globallet@xatkz@init@xmin
  globallet@xbtkz@init@xmax
  globallet@yatkz@init@ymin
  globallet@ybtkz@init@ymax}
 {globallettkz@g@xatkz@init@xmin
  globallettkz@g@xbtkz@init@xmax
  globallettkz@g@yatkz@init@ymin
  globallettkz@g@ybtkz@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){80degree}
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,cosalpha,a,sinalpha)$};
%draw (T2) node[below right] {$Q(alpha)=(a,cosbeta,a,sinbeta)$};
draw (P) +(165:0.6) node {$25degree$};
%draw (P) +(195:0.6) node {$25degree$};
tkzLabelSegment[above right](O,A){$6$ cm}
end{tikzpicture}
end{center}
vspace*{stretch{1}}
end{parts}
end{questions}
end{document}

Correct answer by Torbjørn T. on December 31, 2020

Add your own answers!

Ask a Question

Get help from others!

© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP