![ConTeXt:如何将我的奶牛垂直排列在边缘?](https://linux22.com/image/458952/ConTeXt%EF%BC%9A%E5%A6%82%E4%BD%95%E5%B0%86%E6%88%91%E7%9A%84%E5%A5%B6%E7%89%9B%E5%9E%82%E7%9B%B4%E6%8E%92%E5%88%97%E5%9C%A8%E8%BE%B9%E7%BC%98%EF%BC%9F.png)
在我的 MWE 中,我把 2 头牛放在边缘。
顶部奶牛:我明白了为什么奶牛会突出于边距。我可以将奶牛向下移动(同时仍使用\inmargin
),以便奶牛的顶部位于边距的顶部吗?
底部的牛:我使用了带框的文本location=hanging
,将框架和牛向下移动。但我认为它向下移动了太多。我可以让框架的顶部与“dobesideimage 之后的文本”行的顶部齐平吗?
\showframe
\setupexternalfigures[location=default] % get the cow
%\setuppapersize[A4][A3,landscape] \setuparranging[2SIDE]
\setuplayout[backspace=80mm, width=100mm, topspace=50mm, header=0mm, footer=0mm, height=200mm, margindistance=10mm, leftmargin=40mm]
\definemargindata[mymarginnote][left]
[margin=margin,width=\leftmarginwidth,style={\ss},align=high, ]
\define[3]\dobesideimage% in left margin: image with optional text below
{\mymarginnote
{\framedtext [width=\leftmarginwidth, offset=0mm,location=hanging,]
{#1\\ \externalfigure[#2][width=\leftmarginwidth]\\#3}
}
}
\starttext
\inmargin{\externalfigure[cow][width=\leftmarginwidth]\\I didn’t need a clock, but it was there, and l could, so l did. }
\dorecurse{1}{\input{tufte} }
Text before dobesideimage.
\dobesideimage {Text before cow.}{cow}{So, l recently bought a small clock. I didn’t need a clock, but it was there, and l could, so l did. }
Text after dobesideimage.
\dorecurse{1}{\input{tufte} }
\stoptext
答案1
我认为最好尽可能多地使用内置机制,因为它们可以提供帮助。我不明白你到底想要什么,但我下面建议的也许可以作为一个开始?观察high
图形位置的关键。另外,请注意\movesidefloat
用于将第二幅图像向下推一点的。
\showframe
\setupexternalfigures[location=default] % get the cow
\setuplayout[backspace=80mm, width=100mm, topspace=50mm, header=0mm, footer=0mm, height=200mm, margindistance=10mm, leftmargin=40mm]
\starttext
\startplacefigure
[location={inleft,high,nonumber},
title={I didn’t need a clock, but it was there, and l could, so l did.}]
\externalfigure[cow][width=\leftmarginwidth]
\stopplacefigure
\dorecurse{1}{\samplefile{tufte} }
Text before dobesideimage.
\setupmargindata
[inleftmargin]
[style=sans,
align=flushleft]
\inleftmargin{Text before cow}
\setupcaptions
[style=sans]
\setupcaption
[inleft]
[width=\leftmarginwidth,
align=flushleft]
\movesidefloat[2*line]
\startplacefigure
[location={inleft,high,nonumber},
title={So, l recently bought a small clock. I didn’t need a clock, but it was there, and l could, so l did.}]
\externalfigure[cow][width=\leftmarginwidth]
\stopplacefigure
Text after dobesideimage.
\dorecurse{1}{\samplefile{tufte} }
\stoptext