0

I have a triangle 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 %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} \tkzLabelPointbelow right{$D$} \tkzLabelPointabove right{$E$} \tkzLabelPointbelow left{$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} \tkzLabelPointabove{$C$} \tkzLabelPointbelow{$B$} \tkzLabelSegmentright{$y_1$} \tkzLabelSegmentright{$y_2$} \tkzLabelSegmentbelow{$x_1$} \tkzLabelSegmentbelow{$x_2$} \tkzLabelSegmentabove{$z_1$} \tkzLabelSegmentabove{$z_2$} \tkzMarkRightAnglesize=0.75,opacity=.4 \tkzMarkRightAnglesize=0.75,opacity=.4 \draw{Bar[width=3mm].Latex[]}-{Latex[]Bar[width=3mm]} -- 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}

However if you change the TeX Live distribution from 2018 to 2020, it breaks the diagram and fails to render:

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.

Here is a link to my Overleaf project, in case it helps:

Overleaf MWE

You can try changing the version by going to Menu > TeX Live and seeing what happens. (Remember to uncomment \usetkzobj{all} if you switch TeX Live to 2018, or the diagram won't render properly.)

Any ideas what could be causing the incompatibility or incompatibilities? Thank you!

EthanAlvaree
  • 1,367

1 Answers1

2

The syntax for \tkzDrawXXXX seems to have changed and this affects your \tkzDrawAltitude. This here compiles:

\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}
Ulrike Fischer
  • 327,261