ConTeXt:wrapfigure 与 marginrule 交互

ConTeXt:wrapfigure 与 marginrule 交互

在使用 ConTeXt 时,我遇到了以下 MWE 中描述的问题:

\useexternalfigure[ctanlion][http://www.ctan.org/lion/ctan_lion_350x350.png][width=4cm]
\starttext

\startmarginrule[8]
  Test
\stopmarginrule

\startmarginrule
  Test
\stopmarginrule

\placefigure[here,none,right]{}{\externalfigure[ctanlion]}
\input knuth

\startmarginrule[8]
  Test
\stopmarginrule

\startmarginrule
  Test
\stopmarginrule

\stoptext

在此处输入图片描述

问题也出现在\placefigure[left],但不出现在\placefigure[center]。有人能解释一下并提供解决方法吗?

答案1

这似乎是一个错误anch-bar.mkiv。我已在上发布了一个错误修复ntg-上下文并且已在测试版中合并。

*** /opt/context-minimals/tex/texmf-context/tex/context/base/mkiv/anch-bar.mkiv 2016-08-28 16:55:00.000000000 -0400
--- anch-bar.mkiv 2016-08-28 16:52:47.000000000 -0400
****************
*** 111,118 ***
         \前进\d_anch_sidebars_distance\划痕距离\放松
       \fi
     \别的
       \ifnum\m_level=\plusone
- \scratchdimen\sidebarparameter\c!leftmargindistance\relax
         \ifdim\scratchdimen=\zeropoint
           \前进\d_anch_sidebars_distance\划痕距离\放松
         \别的
--- 111,118 ----
         \前进\d_anch_sidebars_distance\划痕距离\放松
       \fi
     \别的
+ \scratchdimen\sidebarparameter\c!左边界距离\放松
       \ifnum\m_level=\plusone
         \ifdim\scratchdimen=\zeropoint
           \前进\d_anch_sidebars_distance\划痕距离\放松
         \别的

\anch_sidebars_start如果您使用的是旧版本,则可以在当前文件中复制改编的定义:

\unprotect
\def\anch_sidebars_start[#1][#2]%
  {\bgroup
   \dontleavehmode
   \advance\c_anch_sidebars_level\plusone
   \global\advance\c_anch_sidebars_n\plusone
   \c_anch_sidebars_current\c_anch_sidebars_n\relax % relax needed
   \doifelseassignment{#1}
     {\edef\currentsidebar{\the\c_anch_sidebars_level}%
      \checksidebarparent
      \setupcurrentsidebar[#1]}
     {\def\currentsidebar{#1}%
      \setupcurrentsidebar[#2]}%
   \scratchdistance\sidebarparameter\c!distance\relax
   \edef\m_level{\sidebarparameter\c!level}%
   \ifx\m_level\empty
     \ifnum\c_anch_sidebars_level=\plusone
       \scratchdimen\sidebarparameter\c!leftmargindistance\relax
       \ifdim\scratchdimen=\zeropoint
         \advance\d_anch_sidebars_distance\scratchdistance\relax
       \else
         \d_anch_sidebars_distance\scratchdimen
       \fi
     \else
       \advance\d_anch_sidebars_distance\scratchdistance\relax
     \fi
   \else
     \scratchdimen\sidebarparameter\c!leftmargindistance\relax
     \ifnum\m_level=\plusone
       \ifdim\scratchdimen=\zeropoint
         \advance\d_anch_sidebars_distance\scratchdistance\relax
       \else
         \d_anch_sidebars_distance\scratchdimen
       \fi
     \else
       \d_anch_sidebars_distance\dimexpr\scratchdimen+\numexpr\m_level-\plusone\relax\dimexpr\scratchdistance\relax\relax
     \fi
   \fi
   \startpositionoverlay{\v!text-1}%
     \normalexpanded{\setMPpositiongraphicrange % maybe expand in definition
       {b:sidebar:\the\c_anch_sidebars_n}%
       {e:sidebar:\the\c_anch_sidebars_n}%
       {mpos:sidebar}%
       {self=sidebar:\the\c_anch_sidebars_n,
        linewidth=\sidebarparameter\c!rulethickness,
        linecolor=\sidebarparameter\c!rulecolor,
        alternative=\sidebarparameter\c!alternative,
        topoffset=\the\dimexpr\sidebarparameter\c!topoffset,
        bottomoffset=\the\dimexpr\sidebarparameter\c!bottomoffset,
        distance=\the\d_anch_sidebars_distance}%
     }%
   \stoppositionoverlay
   \bpos{sidebar:\the\c_anch_sidebars_current}%
   \ignorespaces}
\protect

\useexternalfigure[ctanlion][http://www.ctan.org/lion/ctan_lion_350x350.png][width=4cm]

\starttext

\startmarginrule[8]
  Test
\stopmarginrule

\startmarginrule
  Test
\stopmarginrule

\placefigure[here,none,right]{}{\externalfigure[ctanlion]}
\input knuth

\startmarginrule[8]
  Test
\stopmarginrule

\startmarginrule
  Test
\stopmarginrule

\stoptext

这使

在此处输入图片描述

相关内容