TikZ:上一个问题的跟进不再有效

TikZ:上一个问题的跟进不再有效

代码来自TikZ:等距离自动换行有效,但我今天注意到它没有产生相同的结果。线条不再重叠。

以下是\listfiles

 *File List*
standalone.cls    2012/09/15 v1.1b Class to compile TeX sub-files standalone
ifluatex.sty    2010/03/01 v1.3 Provides the ifluatex switch (HO)
   ifpdf.sty    2011/01/30 v2.3 Provides the ifpdf switch (HO)
 ifxetex.sty    2010/09/12 v0.6 Provides ifxetex conditional
 xkeyval.sty    2012/10/14 v2.6b package option processing (HA)
 xkeyval.tex    2012/10/14 v2.6b key=value parser (HA)
standalone.cfg    2012/09/15 v1.1b Default configuration file for 'standalone' 
class
 article.cls    2007/10/19 v1.4h Standard LaTeX document class
  size10.clo    2007/10/19 v1.4h Standard LaTeX file (size option)
    tikz.sty    2013/12/13 v3.0.0 (rcs-revision 1.142)
     pgf.sty    2013/12/18 v3.0.0 (rcs-revision 1.14)
  pgfrcs.sty    2013/12/20 v3.0.0 (rcs-revision 1.28)
everyshi.sty    2001/05/15 v3.00 EveryShipout Package (MS)
  pgfrcs.code.tex
 pgfcore.sty    2010/04/11 v3.0.0 (rcs-revision 1.7)
graphicx.sty    1999/02/16 v1.0f Enhanced LaTeX Graphics (DPC,SPQR)
graphics.sty    2009/02/05 v1.0o Standard LaTeX Graphics (DPC,SPQR)
    trig.sty    1999/03/16 v1.09 sin cos tan (DPC)
graphics.cfg    2010/04/23 v1.9 graphics configuration of TeX Live
  pdftex.def    2011/05/27 v0.06d Graphics/color for pdfTeX
infwarerr.sty    2010/04/08 v1.3 Providing info/warning/error messages (HO)
 ltxcmds.sty    2011/11/09 v1.22 LaTeX kernel commands for general use (HO)
  pgfsys.sty    2013/11/30 v3.0.0 (rcs-revision 1.47)
  pgfsys.code.tex
pgfsyssoftpath.code.tex    2013/09/09  (rcs-revision 1.9)
pgfsysprotocol.code.tex    2006/10/16  (rcs-revision 1.4)
  xcolor.sty    2007/01/21 v2.11 LaTeX color extensions (UK)
   color.cfg    2007/01/18 v1.5 color configuration of teTeX/TeXLive
 pgfcore.code.tex
pgfcomp-version-0-65.sty    2007/07/03 v3.0.0 (rcs-revision 1.7)
pgfcomp-version-1-18.sty    2007/07/23 v3.0.0 (rcs-revision 1.1)
  pgffor.sty    2013/12/13 v3.0.0 (rcs-revision 1.25)
 pgfkeys.sty    
 pgfkeys.code.tex
 pgfmath.sty    
 pgfmath.code.tex
  pgffor.code.tex
    tikz.code.tex
inputenx.sty    2011/05/27 v1.10 Enhanced input encoding handling (HO)
ix-alias.def    2011/05/27 v1.10 Alias list (inputenx)
inputenc.sty    2008/03/30 v1.1d Input encoding file
    utf8.def    2008/04/05 v1.1m UTF-8 support for inputenc
   t1enc.dfu    2008/04/05 v1.1m UTF-8 support for inputenc
  ot1enc.dfu    2008/04/05 v1.1m UTF-8 support for inputenc
  omsenc.dfu    2008/04/05 v1.1m UTF-8 support for inputenc
  helvet.sty    2005/04/12 PSNFSS-v9.2a (WaS) 
 courier.sty    2005/04/12 PSNFSS-v9.2a (WaS) 
 eulervm.sty    2005/01/11 v4.0 (WaS)
  ot1ppl.fd    2001/06/04 font definitions for OT1/ppl.
 fontenc.sty
   t1enc.def    2005/09/27 v1.99g Standard LaTeX file
   t1ppl.fd    2001/06/04 font definitions for T1/ppl.
textcomp.sty    2005/09/27 v1.99g Standard LaTeX package
  ts1enc.def    2001/06/05 v3.0e (jk/car/fm) Standard LaTeX file
  ts1enc.dfu    2008/04/05 v1.1m UTF-8 support for inputenc
  ts1cmr.fd    1999/05/25 v2.5h Standard LaTeX font definitions
supp-pdf.mkii
pdftexcmds.sty    2011/11/29 v0.20 Utility functions of pdfTeX for LuaTeX (HO)
epstopdf-base.sty    2010/02/09 v2.5 Base part for package epstopdf
  grfext.sty    2010/08/19 v1.1 Manage graphics extensions (HO)
kvdefinekeys.sty    2011/04/07 v1.3 Define keys (HO)
kvoptions.sty    2011/06/30 v3.11 Key value format for package options (HO)
kvsetkeys.sty    2012/04/25 v1.16 Key value parser (HO)
etexcmds.sty    2011/02/16 v1.5 Avoid name clashes with e-TeX commands (HO)
epstopdf-sys.cfg    2010/07/13 v1.3 Configuration of (r)epstopdf for TeX Live

以下是我使用的代码:

\documentclass[tikz]{standalone}%
% Ensure we are not overriding any existing macro
\newcommand*{\DeltaAngle}{}
\newcommand*{\CurrentStartAngle}{}
\newcommand*{\CurrentEndAngle}{}
\newcommand*{\SegmentedArc}[5][]{%
  % #1 = draw options
  % #2 = number of segments
  % #3 = arc start angle
  % #4 = arc end angle
  % #5 = radius
  \draw[thin, gray] (#5, 0) arc[radius = #5, start angle = #3, end angle = #4];
  % 
  \pgfmathsetmacro{\DeltaAngle}{(#4 - #3)/#2}%
  \foreach \x in {1, ..., #2} {%
    \pgfmathsetmacro{\CurrentStartAngle}{#3 + (\x - 1)*\DeltaAngle}%
    \pgfmathsetmacro{\CurrentEndAngle}{\CurrentStartAngle + \DeltaAngle}%
    \typeout{\string\CurrentStartAngle = \CurrentStartAngle,
      \string\CurrentEndAngle = \CurrentEndAngle}%
    \draw[#1] (\CurrentStartAngle: #5cm) -- (\CurrentEndAngle: #5cm);
  }%
}%
\listfiles
\begin{document}
\begin{tikzpicture}
  \SegmentedArc[thin, red]{4}{20}{100}{2}
\end{tikzpicture}
\end{document}

这是它现在生成的图像:

在此处输入图片描述

答案1

你的问题中的代码有一个错误(你复制错了,你链接到的答案中是正确的):应该是

\draw[thin, gray] (#3:#5) arc[radius = #5, start angle = #3, end angle = #4];

代替

\draw[thin, gray] (#5, 0) arc[radius = #5, start angle = #3, end angle = #4];

仅当您的起始角度恰好为 0 时,您的版本才有效。

相关内容