我想以这个“徽章”的形状写一些东西。
我想让文字填满外套,但有一个大致呈剑形的洞。我知道有\shapepar
创建段落形状的命令,所以我尝试使用ShapePatch
,XFig 的一个补丁,允许您绘制所需的形状,但它在我的计算机(Mac OS X)上从未工作过。我也知道我可以用shapepar
语法自己构建形状,但它看起来真的很复杂,而且我认为我不会制作很多形状。所以如果有人ShapePatch
在他的计算机上工作或shapepar
非常了解语法,他可以给我代码吗?
答案1
这是我使用 Xfig 的尝试。我稍微简化了形状,使其更适合较短的段落。
\def\coatpar#1{\shapepar{\coatshape}#1\par}
\def\coatshape{%
{25.1761}%
{0.176056}b{0.176056}\\%
{0.176056}t{0.176056}{50}\\%
{1.05634}t{0.176056}{0.880282}st{1.05634}{49.1197}\\%
{2.28873}t{0.176056}{0.352113}t{2.46479}{47.7113}\\%
{3.52113}t{0.176056}{1.46262}t{3.87324}{46.3028}\\%
{23.5915}t{0.176056}{19.5481}t{26.8109}{23.3652}\\%
{25.1761}t{0.459004}{20.6929}t{28.6217}{21.5543}\\%
{26.0563}t{0.616197}{21.3289}t{29.6278}{7.16801}st{36.7958}{13.1756}\\%
{28.5211}t{1.05634}{23.1098}t{32.4447}{1.88632}t{39.2606}{10.1376}\\%
{29.4014}t{1.33929}{23.6201}e{33.4507}t{40.1408}{9.05257}\\%
{32.7465}t{2.41449}{25.5591}t{36.6503}{11.7652}\\%
{33.4507}t{2.64085}{25.9673}t{35.9155}{12.1144}\\%
{34.331}t{3.14767}{26.2537}t{36.9312}{10.6166}\\%
{36.7958}t{4.56679}{22.3698}b{32.7465}t{39.7752}{6.42283}\\%
{37.5}t{4.97226}{21.2601}t{32.0423}{1.39245}t{40.5878}{5.22462}\\%
{39.2606}t{5.98592}{22.3592}t{30.2817}{4.87356}t{42.6192}{2.22908}\\%
{40.1408}t{6.62612}{22.7753}jt{29.4014}{6.61412}t{43.6349}{0.73131}\\%
{40.3169}t{6.75416}{29.4334}t{43.838}{0.377263}\\%
{44.5423}t{9.82715}{30.4898}jt{40.3169}{0.27666}\\%
{45.0704}t{10.2113}{29.9296}\\%
{49.2958}t{15.1408}{20.1344}\\%
{50.8803}t{17.5593}{15.8914}\\%
{52.6408}t{20.2465}{9.31246}\\%
{54.2254}e{26.0563}%
}
只需在源文件中直接输入上述命令.tex
,或者(最好)将其保存为外部文件即可\input
。要创建徽章段落,只需将段落文本括在\coatpar
命令中,如下所示:
\coatpar{Lorem ipsum dolor sit amet …}
请注意,为了让最终的徽章段落看起来更好,你应该尝试用几个短的单词。加载该microtype
包也是一个好主意,它通常会产生较少的带连字符的单词和较少的单词间大空格。
这是一段较长段落的结果图。较短的段落自然会显示较少的形状细节。
这里简单解释一下如何创建\coatpar
命令。其实并不难。
- 打开
Xfig
程序。它很丑,也很难用,但对于绘制段落形状来说效果很好。 - 使用多边形工具绘制盾牌和徽章中的剑。请注意,您必须先绘制盾牌(文本容器),最后绘制剑(孔)。我使用 KDE 的不透明度功能使窗口
Xfig
部分透明,这样我就可以看到下面网站上的原始徽章图像。(右键单击标题栏并选择Opacity
。) - 点击
Edit
按钮,然后点击盾牌。输入并应用注释+
。对剑执行相同操作,但将注释设置为-
。 - 将文件另存为
coat.fig
,或者任何其他您喜欢的文件名。 - 运行命令
fig2dev -L shape -n coat coat.fig coat.shape
。这coat.fig
是您将图形保存为的文件名,TeX 代码将存储在文件中coat.shape
。-n
参数指定用于构造shapepar
形状和命令的名称;这里它们将被称为\coatshape
和\coatpar
。该fig2dev
应用程序位于大多数 Linux 发行版中名为 的包中transfig
,或者您可以从Xfig
网站。
也可以使用多边形工具以外的其他工具,但结果可能不如您所愿。例如,绘制圆弧后,使用该Edit
工具添加填充颜色,这将指示形状将如何填充文本。
有关详细信息,请参阅shapepatch
文档和Xfig
手动的。
答案2
我通常只使用\parshape
原始字体而不使用shapepar
软件包,并且我总是为此编写一个元字体程序。这是我的一个元字体程序:
mode_setup;
def showmsg (expr s, m) = message s & "--> " & decimal m; enddef;
mn#:=10/10mm#;
em#:=18mn#;
u#:=1/18em#;
zekh#=1.5u#;
baseline#=1.75dd#;
define_pixels(mn,u,em,zekh,baseline);
%********
beginchar(12,33.3mn#,22.3mn#,0);
path p[];
pickup pencircle scaled .05u;
numeric mntopt, pttodd,ddtopt;
mntopt=25.4/72.27;
pttodd=1238/1157;
ddtopt=1157/1238;
let tttt=end;
x1=0;
y1=.5[y4,y2];
x2=.5[x1,x3];
x3-x1=y2-y4=22.3mn;
y3=y1;
y4=0;
x4=x2;
p1=z1{up}..{right}z2{right}..{down}z3{down}..{left}z4{left}
..{up}z1;
draw p1;
x3-x7=2.8mn;
x6=x8;
x6-x5=12.4mn;
x8-x7=13.8mn;
y6=y5;
y7=y8;
y7-y5=12mn;
y2-y7=3.8mn;
p2=z5--z6;
p3=z7--z8;
draw p2;
draw p3;
z5n=p2 intersectionpoint p1;
z7n=p3 intersectionpoint p1;
showmsg ("last line down", (x6-x5n)/1mm);
showmsg ("1th line up ", (x8-x7n)/1mm);
% showmsg ("fasel y8-y6", (y7-y5)/1mm);
%****************"2th line up";
x9=x7; x10=x8;
y9=y10=y8-baseline;
p4=z9--z10;
draw p4;
z9n=p4 intersectionpoint p1;
showmsg ("2th line up", (x10-x9n)/1mm);
% showmsg ("dd", (y8-y10)/1dd);
% showmsg ("fasel y10-y6", (y10-y6)/1mm);
%******************************"3th line up";
x11=x7; x12=x8;
y11=y12=y10-baseline;
p5=z11--z12;
draw p5;
z11n=p5 intersectionpoint p1;
showmsg ("3th line up", (x12-x11n)/1mm);
% showmsg ("dd", (y10-y12)/1dd);
% showmsg ("fasel y12-y6", (y12-y6)/1mm);
%**********************"4th line up";
x13=x7; x14=x8;
y13=y14=y12-baseline;
p6=z13--z14;
draw p6;
z13n=p6 intersectionpoint p1;
showmsg ("4th line up", (x14-x13n)/1mm);
% showmsg ("dd", (y12-y14)/1dd);
% showmsg ("fasel y14-y6", (y14-y6)/1mm);
% showmsg (" y14", y14/1mm);
% showmsg (" y3", y3/1mm);
%**********************"5th line up";
x15=x7; x16=x8;
y15=y16=y14-baseline;
p7=z15--z16;
draw p7;
z15n=p7 intersectionpoint p1;
showmsg ("5th line up", (x16-x15n)/1mm);
% showmsg ("dd", (y14-y16)/1dd);
% showmsg ("fasel y16-y6", (y16-y6)/1mm);
% showmsg (" y16", y16/1mm);
% showmsg (" y3", y3/1mm);
%**********************"6th line up";
x17=x7; x18=x8;
y17=y18=y16-baseline;
p8=z17--z18;
draw p8;
z17n=p8 intersectionpoint p1;
showmsg ("6th line up", (x18-x17n)/1mm);
% showmsg ("dd", (y16-y18)/1dd);
% showmsg ("fasel y18-y6", (y18-y6)/1mm);
% showmsg (" y18", y18/1mm);
% showmsg (" y3", y3/1mm);
%**********************"7th line up";
x19=x7; x20=x8;
y19=y20=y18-baseline;
p9=z19--z20;
draw p9;
z19n=p9 intersectionpoint p1;
showmsg ("7th line up", (x20-x19n)/1mm);
% showmsg ("dd", (y18-y20)/1dd);
% showmsg ("fasel y20-y6", (y20-y6)/1mm);
% showmsg (" y20", y20/1mm);
% showmsg (" y3", y3/1mm);
%**********************"8th line up";
x21=x7; x22=x8;
y21=y22=y20-baseline;
p10=z21--z22;
draw p10;
z21n=p10 intersectionpoint p1;
showmsg ("8th line up", (x22-x21n)/1mm);
% showmsg ("dd", (y20-y22)/1dd);
% showmsg ("fasel y22-y6", (y22-y6)/1mm);
% showmsg (" y22", y22/1mm);
% showmsg (" y3", y3/1mm);
%**********************"9th line up";
x23=x7; x24=x8;
y23=y24=y22-baseline;
p11=z23--z24;
draw p11;
z23n=p11 intersectionpoint p1;
showmsg ("9th line up", (x24-x23n)/1mm);
% showmsg ("dd", (y22-y24)/1dd);
% showmsg ("fasel y24-y6", (y24-y6)/1mm);
% showmsg (" y24", y24/1mm);
% showmsg (" y3", y3/1mm);
%**********************"10th line up";
x25=x7; x26=x8;
y25=y26=y24-baseline;
p12=z25--z26;
draw p12;
z25n=p12 intersectionpoint p1;
showmsg ("10th line up", (x26-x25n)/1mm);
% showmsg ("dd", (y24-y26)/1dd);
% showmsg ("fasel y26-y6", (y26-y6)/1mm);
% showmsg (" y26", y26/1mm);
% showmsg (" y3", y3/1mm);
%**********************"11th line up";
x27=x7; x28=x8;
y27=y28=y26-baseline;
p13=z27--z28;
draw p13;
z27n=p13 intersectionpoint p1;
showmsg ("11th line up", (x28-x27n)/1mm);
% showmsg ("dd", (y26-y28)/1dd);
% showmsg ("fasel y28-y6", (y28-y6)/1mm);
% showmsg (" y28", y28/1mm);
% showmsg (" y3", y3/1mm);
%**********************"12th line up";
x29=x7; x30=x8;
y29=y30=y28-baseline;
p14=z29--z30;
draw p14;
z29n=p14 intersectionpoint p1;
showmsg ("12th line up", (x30-x29n)/1mm);
% showmsg ("dd", (y28-y30)/1dd);
% showmsg ("fasel y30-y6", (y30-y6)/1mm);
% showmsg (" y30", y30/1mm);
% showmsg (" y3", y3/1mm);
%**********************"13th line up";
x31=x7; x32=x8;
y31=y32=y30-baseline;
p15=z31--z32;
draw p15;
z31n=p15 intersectionpoint p1;
showmsg ("13th line up", (x32-x31n)/1mm);
% showmsg ("dd", (y30-y32)/1dd);
% showmsg ("fasel y32-y6", (y32-y6)/1mm);
if y32-y6 >= baseline :
let next=relax;
else:
def next=endgroup; tttt; enddef;
fi;
next;
% showmsg (" y32", y32/1mm);
% showmsg (" y6", y6/1mm);
%**********************"14th line up";
x33=x7; x34=x8;
y33=y34=y32-baseline;
p16=z33--z34;
draw p16;
z33n=p16 intersectionpoint p1;
showmsg ("14th line up", (x34-x33n)/1mm);
% showmsg ("dd", (y32-y34)/1dd);
% showmsg ("fasel y34-y6", (y34-y6)/1mm);
if y34-y6 >= baseline :
let next=relax;
else:
def next=endgroup; tttt; enddef;
fi;
next;
% showmsg (" y34", y34/1mm);
% showmsg (" y6", y6/1mm);
%**********************"15th line up";
x35=x7; x36=x8;
y35=y36=y34-baseline;
p17=z35--z36;
draw p17;
z35n=p17 intersectionpoint p1;
showmsg ("15th line up", (x36-x35n)/1mm);
% showmsg ("dd", (y34-y36)/1dd);
% showmsg ("fasel y36-y6", (y36-y6)/1mm);
if y36-y6 >= baseline :
let next=relax;
else:
def next=endgroup; tttt; enddef;
fi;
next;
% showmsg (" y36", y36/1mm);
% showmsg (" y6", y6/1mm);
%**********************"16th line up";
x37=x7; x38=x8;
y37=y38=y36-baseline;
p18=z37--z38;
draw p18;
z37n=p18 intersectionpoint p1;
showmsg ("16th line up", (x38-x37n)/1mm);
% showmsg ("dd", (y36-y38)/1dd);
% showmsg ("fasel y38-y6", (y38-y6)/1mm);
if y38-y6 >= baseline :
let next=relax;
else:
def next=endgroup; tttt; enddef;
fi;
next;
% showmsg (" y38", y38/1mm);
% showmsg (" y6", y6/1mm);
%**********************"17th line up";
x39=x7; x40=x8;
y39=y40=y38-baseline;
p19=z39--z40;
draw p19;
z39n=p19 intersectionpoint p1;
showmsg ("17th line up", (x40-x39n)/1mm);
% showmsg ("dd", (y38-y40)/1dd);
% showmsg ("fasel y40-y6", (y40-y6)/1mm);
message " y40"; if y40-y6 >= baseline :
let next=relax;
else:
def next=endgroup; tttt; enddef;
fi;
next;
show y40/1mm;
% showmsg (" y6", y6/1mm);
%**********************"18th line up";
x41=x7; x42=x8;
y41=y42=y40-baseline;
p20=z41--z42;
draw p20;
z41n=p20 intersectionpoint p1;
showmsg ("18th line up", (x42-x41n)/1mm);
% showmsg ("dd", (y40-y42)/1dd);
% showmsg ("fasel y42-y6", (y42-y6)/1mm);
if y42-y6 >= baseline :
let next=relax;
else:
def next=endgroup; tttt; enddef;
fi;
next;
% showmsg (" y42", y42/1mm);
% showmsg (" y6", y6/1mm);
%**********************"19th line up";
x43=x7; x44=x8;
y43=y44=y42-baseline;
p21=z43--z44;
draw p21;
z43n=p21 intersectionpoint p1;
showmsg ("19th line up", (x44-x43n)/1mm);
% showmsg ("dd", (y42-y44)/1dd);
% showmsg ("fasel y44-y6", (y44-y6)/1mm);
if y44-y6 >= baseline :
let next=relax;
else:
def next=endgroup; tttt; enddef;
fi;
next;
% showmsg (" y44", y44/1mm);
% showmsg (" y6", y6/1mm);
%**********************"20th line up";
x45=x7; x46=x8;
y45=y46=y44-baseline;
p22=z45--z46;
draw p22;
z45n=p22 intersectionpoint p1;
showmsg ("20th line up", (x46-x45n)/1mm);
% showmsg ("dd", (y44-y46)/1dd);
% showmsg ("fasel y46-y6", (y46-y6)/1mm);
if y46-y6 >= baseline :
let next=relax;
else:
def next=endgroup; tttt; enddef;
fi;
next;
% showmsg (" y46", y46/1mm);
% showmsg (" y6", y6/1mm);
%**********************"21th line up";
x47=x7; x48=x8;
y47=y48=y46-baseline;
p23=z47--z48;
draw p23;
z47n=p23 intersectionpoint p1;
showmsg ("21th line up", (x48-x47n)/1mm);
% showmsg ("dd", (y46-y48)/1dd);
% showmsg ("fasel y48-y6", (y48-y6)/1mm);
if y48-y6 >= baseline :
let next=relax;
else:
def next=endgroup; tttt; enddef;
fi;
next;
% showmsg (" y48", y48/1mm);
% showmsg (" y6", y6/1mm);
%**********************"22th line up";
x49=x7; x50=x8;
y49=y50=y48-baseline;
p24=z49--z50;
draw p24;
z49n=p24 intersectionpoint p1;
showmsg ("22th line up", (x50-x49n)/1mm);
% showmsg ("dd", (y48-y50)/1dd);
% showmsg ("fasel y50-y6", (y50-y6)/1mm);
if y50-y6 >= baseline :
let next=relax;
else:
def next=endgroup; tttt; enddef;
fi;
next;
% showmsg (" y50", y50/1mm);
% showmsg (" y6", y6/1mm);
%**********************"23th line up";
x51=x7; x52=x8;
y51=y52=y50-baseline;
p25=z51--z52;
draw p25;
z51n=p25 intersectionpoint p1;
showmsg ("23th line up", (x52-x51n)/1mm);
% showmsg ("dd", (y50-y52)/1dd);
% showmsg ("fasel y52-y6", (y52-y6)/1mm);
if y52-y6 >= baseline :
let next=relax;
else:
def next=endgroup; tttt; enddef;
fi;
next;
% showmsg (" y52", y52/1mm);
% showmsg (" y6", y6/1mm);
%**********************"24th line up";
x53=x7; x54=x8;
y53=y54=y52-baseline;
p26=z53--z54;
draw p26;
z53n=p26 intersectionpoint p1;
showmsg ("24th line up", (x54-x53n)/1mm);
% showmsg ("dd", (y52-y54)/1dd);
% showmsg ("fasel y54-y6", (y54-y6)/1mm);
if y54-y6 >= baseline :
let next=relax;
else:
def next=endgroup; tttt; enddef;
fi;
next;
% showmsg (" y54", y54/1mm);
% showmsg (" y6", y6/1mm);
%**********************"25th line up";
x55=x7; x56=x8;
y55=y56=y54-baseline;
p27=z55--z56;
draw p27;
z55n=p27 intersectionpoint p1;
showmsg ("25th line up", (x56-x55n)/1mm);
% showmsg ("dd", (y54-y56)/1dd);
% showmsg ("fasel y56-y6", (y56-y6)/1mm);
if y56-y6 >= baseline :
let next=relax;
else:
def next=endgroup; tttt; enddef;
fi;
next;
% showmsg (" y56", y56/1mm);
% showmsg (" y6", y6/1mm);
%**********************"26th line up";
x57=x7; x58=x8;
y57=y58=y56-baseline;
p28=z57--z58;
draw p28;
z57n=p28 intersectionpoint p1;
showmsg ("26th line up", (x58-x57n)/1mm);
% showmsg ("dd", (y56-y58)/1dd);
% showmsg ("fasel y58-y6", (y58-y6)/1mm);
if y58-y6 >= baseline :
let next=relax;
else:
def next=endgroup; tttt; enddef;
fi;
next;
% showmsg (" y58", y58/1mm);
% showmsg (" y6", y6/1mm);
%**********************"27th line up";
x59=x7; x60=x8;
y59=y60=y58-baseline;
p29=z59--z60;
draw p29;
z59n=p29 intersectionpoint p1;
showmsg ("27th line up", (x60-x59n)/1mm);
% showmsg ("dd", (y58-y60)/1dd);
% showmsg ("fasel y60-y6", (y60-y6)/1mm);
if y60-y6 >= baseline :
let next=relax;
else:
def next=endgroup; tttt; enddef;
fi;
next;
% showmsg (" y60", y60/1mm);
% showmsg (" y6", y6/1mm);
%**********************"28th line up";
x61=x7; x62=x8;
y61=y62=y60-baseline;
p30=z61--z62;
draw p30;
z61n=p30 intersectionpoint p1;
showmsg ("28th line up", (x62-x61n)/1mm);
% showmsg ("dd", (y60-y62)/1dd);
% showmsg ("fasel y62-y6", (y62-y6)/1mm);
if y62-y6 >= baseline :
let next=relax;
else:
def next=endgroup; tttt; enddef;
fi;
next;
% showmsg (" y62", y62/1mm);
% showmsg (" y6", y6/1mm);
%**********************"29th line up";
x63=x7; x64=x8;
y63=y64=y62-baseline;
p31=z63--z64;
draw p31;
z63n=p31 intersectionpoint p1;
showmsg ("29th line up", (x64-x63n)/1mm);
% showmsg ("dd", (y62-y64)/1dd);
% showmsg ("fasel y64-y6", (y64-y6)/1mm);
if y64-y6 >= baseline :
let next=relax;
else:
def next=endgroup; tttt; enddef;
fi;
next;
% showmsg (" y64", y64/1mm);
% showmsg (" y6", y6/1mm);
%**********************"30th line up";
x65=x7; x66=x8;
y65=y66=y64-baseline;
p32=z65--z66;
draw p32;
z65n=p32 intersectionpoint p1;
showmsg ("30th line up", (x66-x65n)/1mm);
% showmsg ("dd", (y64-y66)/1dd);
% showmsg ("fasel y66-y6", (y66-y6)/1mm);
if y66-y6 >= baseline :
let next=relax;
else:
def next=endgroup; tttt; enddef;
fi;
next;
% showmsg (" y66", y66/1mm);
% showmsg (" y6", y6/1mm);
%**********************"31th line up";
x67=x7; x68=x8;
y67=y68=y66-baseline;
p33=z67--z68;
draw p33;
z67n=p33 intersectionpoint p1;
showmsg ("31th line up", (x68-x67n)/1mm);
% showmsg ("dd", (y66-y68)/1dd);
% showmsg ("fasel y68-y6", (y68-y6)/1mm);
if y68-y6 >= baseline :
let next=relax;
else:
def next=endgroup; tttt; enddef;
fi;
next;
% showmsg (" y68", y68/1mm);
% showmsg (" y6", y6/1mm);
%**********************"32th line up";
x69=x7; x70=x8;
y69=y70=y68-baseline;
p34=z69--z70;
draw p34;
z69n=p34 intersectionpoint p1;
showmsg ("32th line up", (x70-x69n)/1mm);
% showmsg ("dd", (y68-y70)/1dd);
% showmsg ("fasel y70-y6", (y70-y6)/1mm);
if y70-y6 >= baseline :
let next=relax;
else:
def next=endgroup; tttt; enddef;
fi;
next;
% showmsg (" y70", y70/1mm);
% showmsg (" y6", y6/1mm);
%**********************"33th line up";
x71=x7; x72=x8;
y71=y72=y70-baseline;
p35=z71--z72;
draw p35;
z71n=p35 intersectionpoint p1;
showmsg ("33th line up", (x72-x71n)/1mm);
% showmsg ("dd", (y70-y72)/1dd);
% showmsg ("fasel y72-y6", (y72-y6)/1mm);
if y72-y6 >= baseline :
let next=relax;
else:
def next=endgroup; tttt; enddef;
fi;
next;
% showmsg (" y72", y72/1mm);
% showmsg (" y6", y6/1mm);
%**********************"34th line up";
x73=x7; x74=x8;
y73=y74=y72-baseline;
p36=z73--z74;
draw p36;
z73n=p36 intersectionpoint p1;
showmsg ("34th line up", (x74-x73n)/1mm);
% showmsg ("dd", (y72-y74)/1dd);
% showmsg ("fasel y74-y6", (y74-y6)/1mm);
if y74-y6 >= baseline :
let next=relax;
else:
def next=endgroup; tttt; enddef;
fi;
next;
% showmsg (" y74", y74/1mm);
% showmsg (" y6", y6/1mm);
%**********************"35th line up";
x75=x7; x76=x8;
y75=y76=y74-baseline;
p37=z75--z76;
draw p37;
z75n=p37 intersectionpoint p1;
showmsg ("35th line up", (x76-x75n)/1mm);
% showmsg ("dd", (y74-y76)/1dd);
% showmsg ("fasel y76-y6", (y76-y6)/1mm);
if y76-y6 >= baseline :
let next=relax;
else:
def next=endgroup; tttt; enddef;
fi;
next;
% showmsg (" y76", y76/1mm);
% showmsg (" y6", y6/1mm);
%**********************
endchar;
bye;
如果你metafont
按照这个方法运行,你会得到:
last line down--> 12.01291
1th line up --> 13.76529
2th line up--> 13.23064
3th line up--> 12.77202
4th line up--> 12.37909
5th line up--> 12.04422
6th line up--> 11.76205
7th line up--> 11.52835
8th line up--> 11.33994
9th line up--> 11.19461
10th line up--> 11.09041
11th line up--> 11.02611
12th line up--> 11.00049
13th line up--> 11.01324
14th line up--> 11.06444
15th line up--> 11.15503
16th line up--> 11.28639
17th line up--> 11.45995
y40
>> 7.9702
18th line up--> 11.6781
19th line up--> 11.9436 )