撇号 ' 与 utf8 不兼容

撇号 ' 与 utf8 不兼容

下面的代码只有在没有utf8包选项inputenc或者从M’和中删除撇号的情况下才有效N’

\documentclass[a4paper, 12pt, twoside]{book}
\usepackage[brazil]{babel}
\usepackage[utf8]{inputenc}
\usepackage{tikz,tkz-euclide,tkz-base}
\usetkzobj{all}
\usetikzlibrary{babel, quotes}

\begin{document}

\begin{tikzpicture}[scale=1.25]
\tkzInit[ymin=-3]
\tkzClip[space=1]
\tkzDefPoint(0,0){A}
\tkzDefPoint(8,0){B}
\tkzDefPoint(3.5,10){I}
\tkzDefMidPoint(A,B) \tkzGetPoint{O}
\tkzDefPointBy[projection=onto A--B](I) \tkzGetPoint{J}
\tkzInterLC(I,A)(O,A) \tkzGetPoints{M’}{M}
\tkzInterLC(I,B)(O,A) \tkzGetPoints{N}{N’}
\tkzDrawCircle[diameter](A,B)
\tkzDrawSegments(I,A I,B A,B B,M A,N)
\tkzMarkRightAngles(A,M,B A,N,B)
\tkzDrawSegment[style=dashed,color=blue](I,J)
\tkzShowTransformation[projection=onto A--B,color=red,size=3,gap=-3](I)
\tkzDrawPoints[color=red](M,N)
\tkzDrawPoints[color=blue](O,A,B,I)
\tkzLabelPoints(O) \tkzLabelPoints[above right](N,I)
\tkzLabelPoints[below left](M,A)
\end{tikzpicture}

\end{document}

错误信息

Missing \endcsname inserted. \tkzInterLC(I,A)(O,A) \tkzGetPoints{M’}{M}
Extra \endcsname. \tkzInterLC(I,A)(O,A) \tkzGetPoints{M’}{M}
Missing \endcsname inserted. \tkzInterLC(I,A)(O,A) \tkzGetPoints{M’}{M}
Missing \endcsname inserted. \tkzInterLC(I,A)(O,A) \tkzGetPoints{M’}{M}
Missing \endcsname inserted. \tkzInterLC(I,A)(O,A) \tkzGetPoints{M’}{M}
Missing \endcsname inserted. \tkzInterLC(I,A)(O,A) \tkzGetPoints{M’}{M}
Missing \endcsname inserted. \tkzInterLC(I,A)(O,A) \tkzGetPoints{M’}{M}
Missing \endcsname inserted. \tkzInterLC(I,B)(O,A) \tkzGetPoints{N}{N’}
Extra \endcsname. \tkzInterLC(I,B)(O,A) \tkzGetPoints{N}{N’}
Missing \endcsname inserted. \tkzInterLC(I,B)(O,A) \tkzGetPoints{N}{N’}
Missing \endcsname inserted. \tkzInterLC(I,B)(O,A) \tkzGetPoints{N}{N’}
Missing \endcsname inserted. \tkzInterLC(I,B)(O,A) \tkzGetPoints{N}{N’}
Missing \endcsname inserted. \tkzInterLC(I,B)(O,A) \tkzGetPoints{N}{N’}
Missing \endcsname inserted. \tkzInterLC(I,B)(O,A) \tkzGetPoints{N}{N’}
Use of \pgf@sh@ma@N doesn't match its definition. \tkzDrawSegments(I,A I,B A,B B,M A,N)
Extra \endcsname. \tkzDrawSegments(I,A I,B A,B B,M A,N)
Use of \pgf@sh@ns@N doesn't match its definition. \tkzDrawSegments(I,A I,B A,B B,M A,N)
Package PGF Math Error: Unknown function `center' (in 'center'). \tkzDrawSegments(I,A I,B A,B B,M A,N)
Use of \pgf@sh@ns@N doesn't match its definition. \tkzDrawSegments(I,A I,B A,B B,M A,N)
Use of \pgf@sh@nt@N doesn't match its definition. \tkzDrawSegments(I,A I,B A,B B,M A,N)
Argument of \xcolor@ has an extra }. \tkzDrawSegments(I,A I,B A,B B,M A,N)
Paragraph ended before \xcolor@ was complete. \tkzDrawSegments(I,A I,B A,B B,M A,N)
Argument of \@next has an extra }. \tkzDrawSegments(I,A I,B A,B B,M A,N)
Paragraph ended before \@next was complete. \tkzDrawSegments(I,A I,B A,B B,M A,N)
Package tikz Error: Giving up on this path. Did you forget a semicolon?. \tkzDrawSegments(I,A I,B A,B B,M A,N)
Missing } inserted. \tkzDrawSegments(I,A I,B A,B B,M A,N)
Missing } inserted. \tkzDrawSegments(I,A I,B A,B B,M A,N)
Missing $ inserted. \tkzDrawSegments(I,A I,B A,B B,M A,N)
Use of \pgf@sh@ma@N doesn't match its definition. \tkzMarkRightAngles(A,M,B A,N,B)
Extra \endcsname. \tkzMarkRightAngles(A,M,B A,N,B)
Use of \pgf@sh@ns@N doesn't match its definition. \tkzMarkRightAngles(A,M,B A,N,B)
Package PGF Math Error: Unknown function `center' (in 'center'). \tkzMarkRightAngles(A,M,B A,N,B)
Use of \pgf@sh@ns@N doesn't match its definition. \tkzMarkRightAngles(A,M,B A,N,B)
Use of \pgf@sh@nt@N doesn't match its definition. \tkzMarkRightAngles(A,M,B A,N,B)
Argument of \xcolor@ has an extra }. \tkzMarkRightAngles(A,M,B A,N,B)
Paragraph ended before \xcolor@ was complete. \tkzMarkRightAngles(A,M,B A,N,B)
Incomplete \iffalse; all text was ignored after line 22.

答案1

从 PDF 文件复制代码经常会导致不正确的 TeX 标记。

例如,如果我复制(版本 1.16c)手册第 40 页的代码tkz-euclide并将其粘贴到这里,我会得到

\begin{tikzpicture}[scale=2]
  \tkzDefPoint(0,0){O}
  \tkzDefPoint(2,-1){A}
  \tkzDefPoint(2,2){B}
  \tkzDefPointsBy[symmetry=center O](B,A){}
  \tkzDrawLine(A,A’)
  \tkzDrawLine(B,B’)
  \tkzMarkAngle[mark=s,arc=lll,size=2 cm,mkcolor=red](A,O,B)
  \tkzLabelAngle[pos=1,circle,draw,fill=blue!10](A,O,B){$60^{\circ}$}
\end{tikzpicture}

不幸的是,这是无效的代码:字体试图变得智能,并将撇号宣传为 U+2019 右单引号,而代码希望将其设为 U+0027 撇号。

不幸的是,除了用 替换之外,你无能为力'。有效代码是

\begin{tikzpicture}[scale=2]
  \tkzDefPoint(0,0){O}
  \tkzDefPoint(2,-1){A}
  \tkzDefPoint(2,2){B}
  \tkzDefPointsBy[symmetry=center O](B,A){}
  \tkzDrawLine(A,A')
  \tkzDrawLine(B,B')
  \tkzMarkAngle[mark=s,arc=lll,size=2 cm,mkcolor=red](A,O,B)
  \tkzLabelAngle[pos=1,circle,draw,fill=blue!10](A,O,B){$60^{\circ}$}
\end{tikzpicture}

您的示例也存在同样的问题。

相关内容