我有一个 SVG 形状,我想将其用作 TikZ 节点边框。该形状基本上是带有描边效果的路径 - 但效果已被“嵌入”,因此现在我只有一个非描边路径作为最终输出;因此它看起来inkscape
像这样:
因此,将其用作“适当的”边框将会很困难 - 所以我想要下一个最好的东西:也就是说,将“边框图像”缩放到矩形节点的大小。
源 SVG 在这里:自定义边框形状.svg。使用 中的 Tikz 导出器inkscape
,我可以将相同的文件导出到tikz
,该文件已粘贴为下面custombordershape_tikz.tex
。(编译它,我获得custombordershape_tikz.pdf
,它用于下面的测试代码)。
这时我发现了两个相关的问题:
第一种方法要好得多 - 但我没有足够的时间将图像中的路径转换为低级 pgf 命令,因此我只能使用缩放后的图像。这让我只能使用第二个链接中的方法,该方法除其他外还推荐\includegraphics
。因此,这里有一个小型 MWE,test.tex
,我用它来尝试一下:
\documentclass{article}
\usepackage{tikz}
\usetikzlibrary{positioning}
\usepackage{lipsum}
\begin{document}
\begin{tikzpicture}
\node[draw=red] (n1) at (1,0) {\pgftext{\includegraphics[width=\linewidth]{custombordershape_tikz.pdf}}Testing};
\node[draw=red,align=left,text width=250pt,minimum width=250pt] (n2) [right=5pt of n1] {\pgftext{\includegraphics[width=\linewidth]{custombordershape_tikz.pdf}}\lipsum[4]};
\end{tikzpicture}
\end{document}
输出如下:
我希望 custombordershape 能够适合相应节点的红色边界框(最好是在文本后面;应该将颜色设为灰色来检查);然而,显然结果并非如此。
那么,推荐使用什么方法来实现“自定义节点”(希望最终只能通过 tikz 样式调用)并使用可缩放至节点大小的外部背景图形?
鉴于我也有tikz
路径格式的背景形状,是否有更简单的方法可以将其重新用于“自定义”节点定义,而不是\includegraphics
在生成的 pdf 上使用?
custombordershape_tikz.tex
:
\documentclass{article}
\usepackage[utf8]{inputenc}
\usepackage{tikz}
\usepackage[active,tightpage]{preview}
\PreviewEnvironment{tikzpicture}
\begin{document}
\begin{tikzpicture}[y=0.80pt,x=0.80pt,yscale=-1, inner sep=0pt, outer sep=0pt]
\begin{scope}[shift={(-82.356111,-10.404272)}]% layer1
% path3193
\path[color=black,draw=black,fill=black,miter limit=4.00,line width=0.800pt]
(88.3126,84.1662) .. controls (119.3839,59.7883) and (150.4194,35.4229) ..
(181.4190,11.0699) .. controls (195.2747,11.0104) and (209.1177,10.9552) ..
(222.9480,10.9043) .. controls (236.0262,11.3164) and (249.1067,12.0061) ..
(262.1675,13.0685) .. controls (276.2273,14.2122) and (290.2969,15.7785) ..
(304.2800,18.1188) .. controls (316.9975,20.2388) and (329.7769,22.9688) ..
(342.1644,27.3079) .. controls (347.3201,29.1118) and (352.4536,31.2466) ..
(357.3736,33.9560) .. controls (357.3736,33.9560) and (357.3736,33.9560) ..
(357.3736,33.9560) .. controls (361.4740,36.1969) and (365.4940,38.9437) ..
(368.9931,42.4708) .. controls (368.9931,42.4708) and (368.9931,42.4708) ..
(368.9931,42.4708) .. controls (371.9776,45.4571) and (374.4607,49.1795) ..
(375.8351,53.5099) .. controls (377.1521,57.9341) and (377.1035,62.5489) ..
(375.9901,66.7999) .. controls (375.9901,66.7999) and (375.9901,66.7999) ..
(375.9900,66.7999) .. controls (375.9900,66.7999) and (375.9900,66.8000) ..
(375.9900,66.8000) .. controls (374.5540,72.2195) and (371.8596,76.9865) ..
(368.7736,81.1359) .. controls (368.7736,81.1359) and (368.7736,81.1359) ..
(368.7736,81.1360) .. controls (364.0149,85.8523) and (358.4752,89.7947) ..
(352.7532,93.2987) .. controls (378.2527,92.4528) and (403.8614,88.7208) ..
(428.3691,80.7837) .. controls (428.3691,80.7837) and (428.3691,80.7837) ..
(428.3691,80.7837) .. controls (446.2121,75.8733) and (463.4729,68.7906) ..
(479.2016,59.1792) .. controls (489.3775,52.9588) and (498.9333,45.7435) ..
(507.2811,37.3486) .. controls (509.5718,35.0452) and (511.7600,32.6737) ..
(513.7769,30.1940) .. controls (513.7769,30.1940) and (513.7769,30.1940) ..
(513.7769,30.1939) .. controls (514.3092,29.5395) and (514.8227,28.8880) ..
(515.3080,28.2333) .. controls (515.4330,28.0647) and (515.5526,27.9012) ..
(515.6654,27.7420) .. controls (516.2398,27.4626) and (516.8118,27.1863) ..
(517.3813,26.9128) .. controls (517.3814,26.9127) and (517.3816,26.9127) ..
(517.3817,26.9126) .. controls (517.3819,26.9125) and (517.3820,26.9124) ..
(517.3822,26.9124) .. controls (517.4610,26.8697) and (517.5397,26.8271) ..
(517.6184,26.7845) .. controls (517.6186,26.7844) and (517.6187,26.7843) ..
(517.6189,26.7842) .. controls (517.6460,26.7696) and (517.6730,26.7549) ..
(517.7000,26.7402) .. controls (517.7001,26.7402) and (517.7001,26.7401) ..
(517.7002,26.7401) .. controls (517.7384,26.7287) and (517.7721,26.7167) ..
(517.8057,26.7046) .. controls (517.9091,26.6699) and (518.0124,26.6353) ..
(518.1158,26.6006) .. controls (518.5242,26.4635) and (518.9322,26.3265) ..
(519.3398,26.1896) .. controls (519.6205,26.2312) and (519.8993,26.2736) ..
(520.1764,26.3161) .. controls (521.2465,26.4805) and (522.3122,26.6515) ..
(523.3742,26.8262) .. controls (527.3249,27.4759) and (531.2608,28.1818) ..
(535.1841,28.9255) .. controls (548.5481,31.4585) and (561.8256,34.4391) ..
(574.9878,37.8572) .. controls (574.9878,37.8572) and (574.9878,37.8572) ..
(574.9879,37.8572) .. controls (592.2183,42.3304) and (609.2859,47.5624) ..
(625.9635,53.9084) .. controls (643.1553,60.4433) and (660.0491,68.1573) ..
(675.6732,78.1250) .. controls (682.8865,82.7271) and (689.8284,87.8512) ..
(696.1810,93.6946) .. controls (696.1811,93.6947) and (696.1811,93.6947) ..
(696.1811,93.6947) .. controls (702.0214,99.0619) and (707.3627,105.0863) ..
(711.6831,111.8630) .. controls (715.7596,118.2581) and (718.8414,125.3501) ..
(720.4470,132.8385) .. controls (722.1070,140.6546) and (722.0962,148.7503) ..
(720.6503,156.5438) .. controls (718.9193,165.8285) and (715.3263,174.6094) ..
(710.7741,182.7058) .. controls (704.9045,193.1590) and (697.5142,202.6154) ..
(689.5039,211.3539) .. controls (679.0292,222.7893) and (667.4380,233.0972) ..
(655.3890,242.7212) .. controls (655.3890,242.7212) and (655.3890,242.7212) ..
(655.3890,242.7212) .. controls (639.7589,255.1596) and (623.3180,266.4937) ..
(606.5183,277.1699) .. controls (606.5183,277.1699) and (606.5183,277.1699) ..
(606.5183,277.1699) .. controls (606.5182,277.1699) and (606.5182,277.1699) ..
(606.5182,277.1699) .. controls (606.5182,277.1699) and (606.5182,277.1699) ..
(606.5182,277.1699) .. controls (573.7686,284.1402) and (540.8445,290.4535) ..
(507.6340,294.7866) .. controls (507.6339,294.7866) and (507.6339,294.7866) ..
(507.6339,294.7866) .. controls (507.6339,294.7866) and (507.6339,294.7866) ..
(507.6339,294.7866) .. controls (487.0405,297.4599) and (466.2315,299.5662) ..
(445.3631,298.9541) .. controls (445.3631,298.9541) and (445.3631,298.9541) ..
(445.3631,298.9541) .. controls (438.7497,298.7611) and (432.0972,298.2685) ..
(425.5230,297.0775) .. controls (420.9242,296.2504) and (416.2952,295.0659) ..
(411.9459,293.0484) .. controls (408.9251,291.6605) and (405.9970,289.7631) ..
(403.7314,287.1009) .. controls (403.7314,287.1009) and (403.7314,287.1009) ..
(403.7314,287.1009) .. controls (401.9395,284.9708) and (400.7335,282.3604) ..
(400.3201,279.5879) .. controls (400.3201,279.5879) and (400.3201,279.5879) ..
(400.3201,279.5878) .. controls (399.9247,276.7962) and (400.2646,274.0063) ..
(401.0113,271.4170) .. controls (401.0113,271.4170) and (401.0113,271.4170) ..
(401.0113,271.4169) .. controls (401.8492,268.4834) and (403.1397,265.7412) ..
(404.6261,263.1742) .. controls (407.9354,257.4513) and (412.1752,252.3870) ..
(416.6561,247.6813) .. controls (416.6561,247.6813) and (416.6562,247.6812) ..
(416.6562,247.6812) .. controls (420.5929,243.5400) and (424.7782,239.6513) ..
(429.1217,235.9664) .. controls (429.1217,235.9664) and (429.1217,235.9664) ..
(429.1217,235.9664) .. controls (430.4943,234.8018) and (431.8855,233.6559) ..
(433.2994,232.5356) .. controls (433.2994,232.5356) and (433.2995,232.5356) ..
(433.2995,232.5356) .. controls (433.9627,232.5266) and (434.6253,232.5167) ..
(435.2874,232.5047) .. controls (435.2924,232.5307) and (435.2981,232.5566) ..
(435.3035,232.5826) .. controls (435.3191,232.6580) and (435.3347,232.7335) ..
(435.3503,232.8090) .. controls (435.3503,232.8091) and (435.3503,232.8092) ..
(435.3503,232.8093) .. controls (435.4119,233.1073) and (435.4734,233.4052) ..
(435.5347,233.7031) .. controls (435.5347,233.7032) and (435.5347,233.7033) ..
(435.5347,233.7034) .. controls (435.3842,233.7004) and (435.2333,233.6974) ..
(435.0821,233.6944) .. controls (434.4957,233.6836) and (433.9088,233.6747) ..
(433.3212,233.6669) .. controls (431.1133,233.6375) and (428.9042,233.6233) ..
(426.6939,233.6190) .. controls (426.6939,233.6190) and (426.6939,233.6190) ..
(426.6939,233.6190) .. controls (418.9800,233.6040) and (411.2649,233.7102) ..
(403.5519,233.9247) .. controls (403.5519,233.9247) and (403.5519,233.9247) ..
(403.5519,233.9247) .. controls (393.0416,234.2171) and (382.5382,234.7124) ..
(372.0552,235.4762) .. controls (372.0552,235.4762) and (372.0552,235.4762) ..
(372.0552,235.4762) .. controls (360.6610,236.3065) and (349.2917,237.4407) ..
(338.0055,239.1229) .. controls (338.0055,239.1229) and (338.0055,239.1229) ..
(338.0055,239.1229) .. controls (338.0054,239.1229) and (338.0054,239.1230) ..
(338.0054,239.1230) .. controls (327.5978,240.6757) and (317.2477,242.6361) ..
(307.2257,245.7016) .. controls (307.2257,245.7016) and (307.2257,245.7016) ..
(307.2256,245.7016) .. controls (303.0114,246.9909) and (298.8644,248.4759) ..
(294.8987,250.3345) .. controls (291.5892,251.8885) and (288.3991,253.6814) ..
(285.6074,255.9566) .. controls (283.3329,257.8176) and (281.3089,259.9987) ..
(280.0584,262.5680) .. controls (278.8967,264.9273) and (278.4530,267.6454) ..
(278.7756,270.2662) .. controls (278.7756,270.2662) and (278.7756,270.2662) ..
(278.7757,270.2663) .. controls (279.1629,273.5211) and (280.6149,276.6279) ..
(282.4305,279.4783) .. controls (282.4305,279.4783) and (282.4305,279.4783) ..
(282.4305,279.4783) .. controls (284.9396,283.7553) and (288.2219,287.5222) ..
(291.7271,291.0324) .. controls (256.9666,294.8001) and (221.3088,293.1164) ..
(188.1927,282.3136) .. controls (188.1927,282.3136) and (188.1926,282.3136) ..
(188.1926,282.3136) .. controls (164.6618,274.5301) and (142.6438,262.0560) ..
(124.3125,245.4118) .. controls (111.5478,233.8214) and (100.5184,220.3117) ..
(91.8691,205.4131) .. controls (91.8691,205.4131) and (91.8691,205.4131) ..
(91.8691,205.4131) .. controls (91.8691,205.4131) and (91.8691,205.4131) ..
(91.8691,205.4131) .. controls (89.3190,201.0206) and (86.9709,196.5078) ..
(84.9234,191.8606) .. controls (84.3653,190.5940) and (83.8294,189.3172) ..
(83.3314,188.0256) .. controls (83.3314,188.0256) and (83.3314,188.0256) ..
(83.3314,188.0256) .. controls (83.3314,188.0256) and (83.3314,188.0256) ..
(83.3313,188.0256) .. controls (83.2013,187.6883) and (83.0738,187.3499) ..
(82.9510,187.0097) .. controls (82.9247,186.9208) and (82.8986,186.8318) ..
(82.8730,186.7426) .. controls (82.8690,186.7191) and (82.8650,186.6956) ..
(82.8611,186.6721) .. controls (82.8601,186.6661) and (82.8591,186.6601) ..
(82.8581,186.6542) .. controls (82.8564,186.6482) and (82.8567,186.6482) ..
(82.8571,186.6482) .. controls (82.8568,186.6483) and (82.8564,186.6484) ..
(82.8561,186.6485) .. controls (82.8591,186.6604) and (82.8601,186.6664) ..
(82.8611,186.6723) .. controls (82.8651,186.6958) and (82.8691,186.7193) ..
(82.8733,186.7428) .. controls (82.8733,186.7428) and (82.8733,186.7428) ..
(82.8733,186.7428) .. controls (82.8992,186.8319) and (82.9259,186.9207) ..
(82.9530,187.0093) .. controls (83.0778,187.3487) and (83.2073,187.6863) ..
(83.3393,188.0228) .. controls (83.3394,188.0228) and (83.3394,188.0229) ..
(83.3394,188.0229) .. controls (83.3394,188.0229) and (83.3394,188.0229) ..
(83.3394,188.0229) .. controls (83.8450,189.3113) and (84.3883,190.5845) ..
(84.9536,191.8475) .. controls (87.0279,196.4813) and (89.4013,200.9772) ..
(91.9753,205.3514) .. controls (91.9753,205.3514) and (91.9753,205.3514) ..
(91.9753,205.3514) .. controls (100.7056,220.1874) and (111.7982,233.6080) ..
(124.5992,245.0945) .. controls (124.5992,245.0945) and (124.5992,245.0945) ..
(124.5992,245.0945) .. controls (124.5992,245.0945) and (124.5992,245.0945) ..
(124.5992,245.0945) .. controls (142.9800,261.5882) and (164.9952,273.8811) ..
(188.4621,281.4913) .. controls (188.4621,281.4913) and (188.4621,281.4913) ..
(188.4621,281.4913) .. controls (221.4094,292.3079) and (256.7636,294.1822) ..
(291.1511,290.8420) .. controls (291.1511,290.8420) and (291.1511,290.8420) ..
(291.1511,290.8420) .. controls (287.4379,287.7146) and (283.9099,284.2978) ..
(281.1132,280.3287) .. controls (281.1132,280.3287) and (281.1132,280.3287) ..
(281.1132,280.3287) .. controls (279.1856,277.3775) and (277.6334,274.0594) ..
(277.1594,270.4701) .. controls (277.1594,270.4701) and (277.1594,270.4701) ..
(277.1594,270.4700) .. controls (276.7826,267.5370) and (277.2593,264.5058) ..
(278.5493,261.8332) .. controls (279.9442,258.9712) and (282.1059,256.5853) ..
(284.5104,254.6164) .. controls (287.4450,252.2051) and (290.7464,250.3155) ..
(294.1313,248.7091) .. controls (298.1886,246.7805) and (302.4079,245.2392) ..
(306.6718,243.9092) .. controls (316.8073,240.7470) and (327.2427,238.7027) ..
(337.6953,237.0836) .. controls (337.6953,237.0836) and (337.6953,237.0836) ..
(337.6954,237.0836) .. controls (349.0375,235.3251) and (360.4545,234.1173) ..
(371.8840,233.2172) .. controls (382.4008,232.3886) and (392.9365,231.8293) ..
(403.4765,231.4739) .. controls (411.2110,231.2131) and (418.9504,231.0609) ..
(426.6913,231.0302) .. controls (428.9093,231.0212) and (431.1284,231.0222) ..
(433.3485,231.0392) .. controls (433.9393,231.0432) and (434.5308,231.0492) ..
(435.1228,231.0565) .. controls (435.2755,231.0585) and (435.4285,231.0605) ..
(435.5818,231.0625) .. controls (435.7170,231.3514) and (435.8523,231.6404) ..
(435.9877,231.9295) .. controls (435.9878,231.9297) and (435.9879,231.9299) ..
(435.9880,231.9301) .. controls (436.0222,232.0032) and (436.0565,232.0762) ..
(436.0907,232.1493) .. controls (436.1024,232.1744) and (436.1142,232.1995) ..
(436.1259,232.2245) .. controls (436.1260,232.2246) and (436.1260,232.2247) ..
(436.1261,232.2248) .. controls (435.7314,233.0212) and (435.3373,233.8193) ..
(434.9438,234.6191) .. controls (434.9438,234.6191) and (434.9438,234.6192) ..
(434.9438,234.6192) .. controls (433.5660,235.7241) and (432.2080,236.8564) ..
(430.8653,238.0094) .. controls (426.6053,241.6681) and (422.5135,245.5142) ..
(418.6810,249.5949) .. controls (418.6810,249.5949) and (418.6810,249.5949) ..
(418.6810,249.5949) .. controls (414.3160,254.2504) and (410.2383,259.1617) ..
(407.1421,264.6163) .. controls (405.7579,267.0585) and (404.5756,269.5874) ..
(403.8525,272.2146) .. controls (403.8525,272.2147) and (403.8525,272.2147) ..
(403.8525,272.2147) .. controls (403.8525,272.2147) and (403.8525,272.2147) ..
(403.8525,272.2147) .. controls (403.2241,274.5233) and (402.9260,276.9016) ..
(403.2832,279.1449) .. controls (403.2832,279.1449) and (403.2832,279.1449) ..
(403.2832,279.1450) .. controls (403.6122,281.3347) and (404.6065,283.4372) ..
(406.0533,285.1383) .. controls (407.9018,287.3420) and (410.4877,288.9534) ..
(413.2459,290.2380) .. controls (417.2474,292.0829) and (421.6264,293.1596) ..
(426.0817,293.9490) .. controls (432.4402,295.0673) and (438.9334,295.5045) ..
(445.4508,295.6611) .. controls (466.0349,296.1527) and (486.6415,293.9334) ..
(507.1527,291.1570) .. controls (507.1527,291.1570) and (507.1527,291.1570) ..
(507.1528,291.1570) .. controls (539.9917,286.7330) and (572.5370,280.3412) ..
(604.9239,273.3024) .. controls (604.9239,273.3024) and (604.9239,273.3024) ..
(604.9239,273.3024) .. controls (604.9239,273.3024) and (604.9239,273.3024) ..
(604.9240,273.3024) .. controls (604.9240,273.3024) and (604.9240,273.3024) ..
(604.9240,273.3024) .. controls (621.3553,262.6722) and (637.3694,251.4293) ..
(652.5064,239.1354) .. controls (652.5064,239.1354) and (652.5064,239.1354) ..
(652.5064,239.1354) .. controls (664.3691,229.5375) and (675.7227,219.3277) ..
(685.9006,208.0741) .. controls (693.6794,199.4670) and (700.7929,190.2748) ..
(706.3357,180.2343) .. controls (710.6193,172.4643) and (713.9719,164.1891) ..
(715.4941,155.6052) .. controls (715.4941,155.6051) and (715.4941,155.6051) ..
(715.4941,155.6051) .. controls (716.7728,148.4327) and (716.7475,141.0272) ..
(715.1927,133.9746) .. controls (713.7146,127.2018) and (710.8371,120.7233) ..
(707.0470,114.8312) .. controls (703.0181,108.5669) and (697.9529,102.9434) ..
(692.3717,97.8565) .. controls (692.3717,97.8565) and (692.3717,97.8565) ..
(692.3717,97.8565) .. controls (686.2924,92.3208) and (679.5873,87.4413) ..
(672.5706,83.0148) .. controls (657.3562,73.4160) and (640.7835,65.9847) ..
(623.8053,59.6292) .. controls (607.3448,53.4741) and (590.4662,48.4118) ..
(573.3904,44.0834) .. controls (573.3904,44.0834) and (573.3904,44.0834) ..
(573.3904,44.0834) .. controls (573.3903,44.0834) and (573.3903,44.0834) ..
(573.3903,44.0834) .. controls (573.3903,44.0834) and (573.3903,44.0834) ..
(573.3903,44.0834) .. controls (560.3464,40.7781) and (547.1938,37.9071) ..
(533.9616,35.4799) .. controls (530.0770,34.7674) and (526.1906,34.0939) ..
(522.3003,33.4778) .. controls (522.3003,33.4778) and (522.3003,33.4778) ..
(522.3003,33.4778) .. controls (522.3003,33.4778) and (522.3003,33.4778) ..
(522.3003,33.4778) .. controls (522.3003,33.4778) and (522.3003,33.4778) ..
(522.3003,33.4778) .. controls (521.2545,33.3122) and (520.2112,33.1511) ..
(519.1700,32.9974) .. controls (518.9003,32.9577) and (518.6323,32.9186) ..
(518.3658,32.8806) .. controls (518.6320,32.7243) and (518.8986,32.5680) ..
(519.1656,32.4119) .. controls (519.2331,32.3724) and (519.3007,32.3329) ..
(519.3683,32.2934) .. controls (519.3928,32.2802) and (519.4174,32.2670) ..
(519.4419,32.2538) .. controls (519.4379,32.2531) and (519.4379,32.2531) ..
(519.4379,32.2530) .. controls (519.4592,32.2467) and (519.4805,32.2405) ..
(519.5018,32.2342) .. controls (519.5636,32.2159) and (519.6253,32.1976) ..
(519.6871,32.1792) .. controls (519.6872,32.1792) and (519.6873,32.1792) ..
(519.6875,32.1791) .. controls (520.1883,32.0021) and (520.6910,31.8216) ..
(521.1957,31.6380) .. controls (521.0476,31.8493) and (520.9010,32.0526) ..
(520.7571,32.2489) .. controls (520.7571,32.2489) and (520.7570,32.2489) ..
(520.7570,32.2489) .. controls (520.1981,33.0112) and (519.6265,33.7465) ..
(519.0517,34.4607) .. controls (519.0517,34.4607) and (519.0517,34.4607) ..
(519.0517,34.4608) .. controls (516.8727,37.1680) and (514.5477,39.7220) ..
(512.1461,42.1616) .. controls (503.3887,51.0566) and (493.4424,58.6755) ..
(482.8983,65.1925) .. controls (482.8983,65.1925) and (482.8983,65.1925) ..
(482.8983,65.1925) .. controls (466.5823,75.2802) and (448.7475,82.7379) ..
(430.3496,87.9053) .. controls (404.2711,94.0406) and (377.1130,95.7334) ..
(350.1087,94.2811) .. controls (354.7073,88.6842) and (358.9805,82.8454) ..
(362.3239,76.4397) .. controls (362.3240,76.4397) and (362.3240,76.4396) ..
(362.3240,76.4396) .. controls (364.9737,72.7114) and (367.2125,68.8436) ..
(368.1732,64.8166) .. controls (368.9028,61.8032) and (368.9645,58.6484) ..
(368.0672,55.9121) .. controls (368.0672,55.9120) and (368.0672,55.9120) ..
(368.0672,55.9120) .. controls (367.2438,53.1355) and (365.4058,50.5364) ..
(363.1625,48.2319) .. controls (360.4463,45.4690) and (357.0448,43.2228) ..
(353.3934,41.2110) .. controls (349.0061,38.8142) and (344.2840,36.8969) ..
(339.4140,35.2122) .. controls (327.6849,31.1595) and (315.3633,28.6244) ..
(302.8851,26.6001) .. controls (302.8851,26.6001) and (302.8850,26.6001) ..
(302.8850,26.6001) .. controls (302.8850,26.6001) and (302.8850,26.6001) ..
(302.8850,26.6001) .. controls (289.2010,24.3896) and (275.3678,22.9356) ..
(261.4752,21.8849) .. controls (248.6103,20.9121) and (235.7094,20.3075) ..
(222.7928,19.9756) .. controls (209.9469,19.7763) and (197.1140,19.5727) ..
(184.2940,19.3648) .. controls (154.3411,43.5847) and (124.4246,67.7921) ..
(94.5446,91.9868) -- cycle;
\end{scope}
\end{tikzpicture}
\end{document}
答案1
嗯,这里有一种方法,path picture
使用具有多种形状的 TikZ 节点并按照\includegraphics
手册第 165 页“15.5 广义填充:使用任意图片填充路径”中的示例进行操作。诀窍基本上就是计算节点的大小,并将其应用于所包含图形的大小。这是输出:
请注意,较大的形状在右边缘有些错误地被剪裁;可以通过取消注释\p3
代码中使用的手动位移来修复,但这有点蛮力的方法。如果有人知道更合适的方法来实现这一点,请发布答案。
代码:
\documentclass{article}
\usepackage{tikz}
\usetikzlibrary{positioning}
\usetikzlibrary{calc}
\usepackage{lipsum}
\begin{document}
\begin{tikzpicture}
\tikzset{zzz/.style={
%draw=red,
path picture={%
%\pgftext{\includegraphics[width=\linewidth]{custombordershape_tikz.pdf}};
\path let
\p1=(path picture bounding box.south west),
\p2=(path picture bounding box.north east)
in
[draw=red] (\p1) -- (\p2)
coordinate (nsz) at ($(\p2)-(\p1)-(2*\pgflinewidth,2*\pgflinewidth)$) ;
\path let
\p1=(nsz),
\p2=(path picture bounding box.center),
\p3=(\p2)
% \p3=($(\p2)-(0.008*\x1,0)$)
in
node[anchor=center] at (\p3) {
\includegraphics[width=\x1,height=\y1]{custombordershape_tikz.pdf}
};
}}}
\node[zzz] (n1) at (1,0) {Testing};
\node[align=left,text width=250pt,minimum width=250pt,zzz] (n2) [right=5pt of n1] {\lipsum[4]};
\end{tikzpicture}
\end{document}