Tikz 的独立图片有额外的空白

Tikz 的独立图片有额外的空白

我正在尝试使用 Tikz 来创建standalone图形,使用下面的代码片段:

\documentclass{standalone}
\usepackage[utf8]{inputenc}
\usepackage{tikz}

\begin{document}
\definecolor{cff0000}{RGB}{255,0,0}
\begin{tikzpicture}[y=0.80pt, x=0.80pt, yscale=-1.000000, xscale=1.000000, inner sep=0pt, outer sep=0pt]
  \path[fill=cff0000,nonzero rule,line width=0.056pt] (50.4060,155.6110) ..
    controls (52.4160,150.8598) and (53.9892,145.9526) .. (55.4555,141.0119) ..
    controls (57.4600,133.2451) and (60.4747,125.7999) .. (64.1036,118.6628) ..
    controls (67.4267,112.6615) and (71.5768,107.1252) .. (76.3371,102.1861) ..
    controls (79.5723,98.8295) and (81.3080,97.4647) .. (84.8431,94.3983) ..
    controls (91.5688,89.0830) and (98.5156,83.9503) .. (105.9551,79.6618) ..
    controls (110.0436,77.3050) and (114.1648,75.0053) .. (118.2697,72.6771) ..
    controls (121.6899,70.8968) and (125.1594,69.0372) .. (129.0161,68.4750) ..
    controls (131.9887,68.0477) and (134.8104,68.6073) .. (137.6307,69.5194) ..
    controls (143.9190,71.8817) and (149.5344,75.7244) .. (154.8825,79.7218) ..
    controls (160.8059,84.3816) and (166.8873,89.4797) .. (170.3078,96.3691) ..
    controls (171.0165,97.7965) and (171.5005,99.3248) .. (172.0968,100.8027) ..
    controls (173.6510,105.8010) and (174.6299,110.9610) .. (174.6002,116.2137) ..
    controls (174.5659,122.2784) and (173.3665,128.2607) .. (172.3004,134.2015) ..
    controls (170.4062,142.6955) and (168.0524,151.1030) .. (165.1778,159.3190) ..
    controls (164.0966,162.1521) and (163.0487,165.1824) .. (160.7297,167.2789) ..
    controls (160.1514,167.8017) and (159.5284,168.2867) .. (158.8492,168.6692) ..
    controls (154.9330,170.8751) and (150.9242,172.9124) .. (146.9617,175.0340) ..
    controls (140.2888,176.4256) and (133.3444,176.9538) .. (126.5260,176.7204) ..
    controls (124.9102,176.6651) and (123.3011,176.4844) .. (121.6886,176.3664) ..
    controls (111.5400,175.3728) and (102.0416,171.5015) .. (92.7336,167.5742) ..
    controls (87.4440,165.1308) and (81.9165,163.1396) .. (76.8813,160.1791) ..
    controls (74.8170,159.1467) and (73.3315,157.6182) .. (72.5186,155.4724) ..
    controls (71.9054,153.3280) and (72.1078,151.0694) .. (72.1380,148.8682) ..
    controls (72.9688,142.2459) and (75.5202,135.9704) .. (77.9705,129.8095) ..
    controls (80.2565,124.5915) and (81.9607,119.0628) .. (84.7842,114.0945) ..
    controls (87.6673,110.0012) and (91.2216,109.2017) .. (96.5280,106.3257) ..
    controls (97.0993,106.0161) and (97.8633,106.4676) .. (98.2299,106.8322) ..
    controls (98.5120,107.1128) and (98.6811,107.4878) .. (98.9067,107.8155) ..
    controls (99.0594,108.3122) and (99.2561,108.7974) .. (99.3648,109.3054) ..
    controls (99.6556,110.6652) and (99.7570,112.5226) .. (99.8240,113.8652) ..
    controls (99.9892,117.1750) and (99.9923,120.4916) .. (100.0153,123.8043) ..
    controls (100.0398,130.7413) and (100.0558,137.6784) .. (100.0859,144.6154) ..
    controls (100.0966,148.7932) and (100.1543,152.9707) .. (100.1826,157.1484) ..
    controls (100.3827,159.8778) and (99.9938,162.5337) .. (99.3635,165.1788) ..
    controls (98.4978,168.5698) and (97.3903,171.8913) .. (96.5564,175.2902) ..
    controls (95.9114,178.5176) and (95.5458,181.7879) .. (94.9067,185.0178) ..
    controls (94.1239,188.9561) and (93.6212,192.9402) .. (92.9512,196.8988) ..
    controls (92.5207,199.8064) and (92.0203,202.7009) .. (91.3802,205.5695) ..
    controls (91.3802,205.5695) and (81.3862,210.3721) .. (81.3862,210.3721) --
    (81.3862,210.3721) .. controls (82.1026,207.5155) and (82.6857,204.6347) ..
    (83.0880,201.7147) .. controls (83.7786,197.7564) and (84.2453,193.7696) ..
    (85.0058,189.8251) .. controls (85.6258,186.5852) and (86.0175,183.3131) ..
    (86.5887,180.0701) .. controls (87.4235,176.6795) and (88.5352,173.3703) ..
    (89.3599,169.9778) .. controls (90.0030,167.4067) and (90.5010,164.8416) ..
    (90.3198,162.1729) .. controls (90.3539,157.9561) and (90.4235,153.7397) ..
    (90.4500,149.5229) .. controls (90.5044,142.5748) and (90.5632,135.6260) ..
    (90.4808,128.6779) .. controls (90.3856,123.6401) and (90.5786,118.4161) ..
    (89.2843,113.5149) .. controls (88.9569,113.1268) and (88.9868,112.9311) ..
    (88.4510,113.0674) .. controls (88.2268,113.1244) and (87.6169,113.4648) ..
    (87.8150,113.3453) .. controls (104.0329,103.5597) and (97.5781,106.7800) ..
    (94.8982,109.6313) .. controls (91.6491,114.4227) and (89.9636,120.1187) ..
    (87.5922,125.3542) .. controls (85.2469,131.3456) and (82.8063,137.4348) ..
    (81.9777,143.8564) .. controls (82.0005,145.9182) and (81.9287,148.0175) ..
    (82.3174,150.0505) .. controls (82.9549,151.9974) and (84.3901,153.1977) ..
    (86.1580,154.1786) .. controls (91.0143,157.1724) and (96.3313,159.3076) ..
    (101.4737,161.7466) .. controls (110.6821,165.7013) and (120.1303,169.4307) ..
    (130.2183,170.2546) .. controls (131.8185,170.3484) and (133.4162,170.5018) ..
    (135.0188,170.5359) .. controls (141.7507,170.6793) and (149.0025,170.1335) ..
    (155.4998,168.3189) .. controls (153.2217,169.7651) and (150.9316,171.1925) ..
    (148.6656,172.6576) .. controls (148.0327,173.0668) and (149.9961,171.9381) ..
    (150.5998,171.4870) .. controls (153.1000,169.6192) and (154.2496,166.6874) ..
    (155.3685,163.8914) .. controls (158.4973,155.6858) and (161.0681,147.2577) ..
    (163.0556,138.7038) .. controls (164.1400,132.8491) and (165.3431,126.9654) ..
    (165.3750,120.9809) .. controls (165.4024,115.8497) and (164.4392,110.8158) ..
    (162.9174,105.9344) .. controls (161.3596,102.1109) and (161.2635,101.2517) ..
    (158.9088,97.8821) .. controls (155.4441,92.9243) and (150.7080,89.0177) ..
    (145.9339,85.3947) .. controls (140.5588,81.5211) and (134.9074,77.7903) ..
    (128.5613,75.7188) .. controls (125.7797,74.9765) and (122.9803,74.6423) ..
    (120.1219,75.1830) .. controls (116.5021,75.9711) and (113.1933,77.6751) ..
    (109.9323,79.3871) .. controls (111.9018,78.2073) and (113.8809,77.0436) ..
    (115.8407,75.8479) .. controls (117.0603,75.1037) and (113.3688,77.2821) ..
    (112.1528,78.0323) .. controls (105.9947,81.8315) and (100.0660,86.0176) ..
    (94.4043,90.5211) .. controls (91.0018,93.4299) and (89.0288,94.9866) ..
    (85.9001,98.1693) .. controls (81.1662,102.9850) and (77.0593,108.4125) ..
    (73.7619,114.3050) .. controls (70.1189,121.3474) and (67.0693,128.7008) ..
    (65.1476,136.4129) .. controls (63.7753,141.2732) and (62.4014,146.1413) ..
    (60.5056,150.8305) .. controls (60.5056,150.8305) and (50.4060,155.6110) ..
    (50.4060,155.6110) -- cycle;

\end{tikzpicture}
\end{document}

令我惊讶的是,图的左侧增加了额外的空白。 在此处输入图片描述

注意:此 MWE 是tikz使用 中的扩展创建的inkscape

答案1

它被称为“虚假空间”,在 TeX 中,通常是由未注释的行尾引起的。

作为补救措施,请注释掉有问题的行:

\definecolor{cff0000}{RGB}{255,0,0}% <-- `%' added

答案2

独立包有一个专用tikz选项,可以创建单个图像tikzpicture environment并裁剪边框。

手册第 8 页:

独立类将裁剪生成的输出文件(PDF 或 DVI/PS)为内容大小加上特定边框。页码和其他页眉或页脚材料将被抑制。对于使用 TikZ 绘制的图片,提供了专用的 tikz 选项,该选项可加载 tikz 包并配置 tikzpicture 环境以创建单个裁剪页面。

要添加 5 毫米宽的边框,只需添加边框选项,如下所示:

\documentclass[tikz,border=5mm]{standalone}

无边框的代码是:

\documentclass[tikz]{standalone}
\usepackage[utf8]{inputenc}

\begin{document}
\definecolor{cff0000}{RGB}{255,0,0}
\begin{tikzpicture}[y=0.80pt, x=0.80pt, yscale=-1.000000, xscale=1.000000, inner sep=0pt, outer sep=0pt]
  \path[fill=cff0000,nonzero rule,line width=0.056pt] (50.4060,155.6110) ..
    controls (52.4160,150.8598) and (53.9892,145.9526) .. (55.4555,141.0119) ..
    controls (57.4600,133.2451) and (60.4747,125.7999) .. (64.1036,118.6628) ..
    controls (67.4267,112.6615) and (71.5768,107.1252) .. (76.3371,102.1861) ..
    controls (79.5723,98.8295) and (81.3080,97.4647) .. (84.8431,94.3983) ..
    controls (91.5688,89.0830) and (98.5156,83.9503) .. (105.9551,79.6618) ..
    controls (110.0436,77.3050) and (114.1648,75.0053) .. (118.2697,72.6771) ..
    controls (121.6899,70.8968) and (125.1594,69.0372) .. (129.0161,68.4750) ..
    controls (131.9887,68.0477) and (134.8104,68.6073) .. (137.6307,69.5194) ..
    controls (143.9190,71.8817) and (149.5344,75.7244) .. (154.8825,79.7218) ..
    controls (160.8059,84.3816) and (166.8873,89.4797) .. (170.3078,96.3691) ..
    controls (171.0165,97.7965) and (171.5005,99.3248) .. (172.0968,100.8027) ..
    controls (173.6510,105.8010) and (174.6299,110.9610) .. (174.6002,116.2137) ..
    controls (174.5659,122.2784) and (173.3665,128.2607) .. (172.3004,134.2015) ..
    controls (170.4062,142.6955) and (168.0524,151.1030) .. (165.1778,159.3190) ..
    controls (164.0966,162.1521) and (163.0487,165.1824) .. (160.7297,167.2789) ..
    controls (160.1514,167.8017) and (159.5284,168.2867) .. (158.8492,168.6692) ..
    controls (154.9330,170.8751) and (150.9242,172.9124) .. (146.9617,175.0340) ..
    controls (140.2888,176.4256) and (133.3444,176.9538) .. (126.5260,176.7204) ..
    controls (124.9102,176.6651) and (123.3011,176.4844) .. (121.6886,176.3664) ..
    controls (111.5400,175.3728) and (102.0416,171.5015) .. (92.7336,167.5742) ..
    controls (87.4440,165.1308) and (81.9165,163.1396) .. (76.8813,160.1791) ..
    controls (74.8170,159.1467) and (73.3315,157.6182) .. (72.5186,155.4724) ..
    controls (71.9054,153.3280) and (72.1078,151.0694) .. (72.1380,148.8682) ..
    controls (72.9688,142.2459) and (75.5202,135.9704) .. (77.9705,129.8095) ..
    controls (80.2565,124.5915) and (81.9607,119.0628) .. (84.7842,114.0945) ..
    controls (87.6673,110.0012) and (91.2216,109.2017) .. (96.5280,106.3257) ..
    controls (97.0993,106.0161) and (97.8633,106.4676) .. (98.2299,106.8322) ..
    controls (98.5120,107.1128) and (98.6811,107.4878) .. (98.9067,107.8155) ..
    controls (99.0594,108.3122) and (99.2561,108.7974) .. (99.3648,109.3054) ..
    controls (99.6556,110.6652) and (99.7570,112.5226) .. (99.8240,113.8652) ..
    controls (99.9892,117.1750) and (99.9923,120.4916) .. (100.0153,123.8043) ..
    controls (100.0398,130.7413) and (100.0558,137.6784) .. (100.0859,144.6154) ..
    controls (100.0966,148.7932) and (100.1543,152.9707) .. (100.1826,157.1484) ..
    controls (100.3827,159.8778) and (99.9938,162.5337) .. (99.3635,165.1788) ..
    controls (98.4978,168.5698) and (97.3903,171.8913) .. (96.5564,175.2902) ..
    controls (95.9114,178.5176) and (95.5458,181.7879) .. (94.9067,185.0178) ..
    controls (94.1239,188.9561) and (93.6212,192.9402) .. (92.9512,196.8988) ..
    controls (92.5207,199.8064) and (92.0203,202.7009) .. (91.3802,205.5695) ..
    controls (91.3802,205.5695) and (81.3862,210.3721) .. (81.3862,210.3721) --
    (81.3862,210.3721) .. controls (82.1026,207.5155) and (82.6857,204.6347) ..
    (83.0880,201.7147) .. controls (83.7786,197.7564) and (84.2453,193.7696) ..
    (85.0058,189.8251) .. controls (85.6258,186.5852) and (86.0175,183.3131) ..
    (86.5887,180.0701) .. controls (87.4235,176.6795) and (88.5352,173.3703) ..
    (89.3599,169.9778) .. controls (90.0030,167.4067) and (90.5010,164.8416) ..
    (90.3198,162.1729) .. controls (90.3539,157.9561) and (90.4235,153.7397) ..
    (90.4500,149.5229) .. controls (90.5044,142.5748) and (90.5632,135.6260) ..
    (90.4808,128.6779) .. controls (90.3856,123.6401) and (90.5786,118.4161) ..
    (89.2843,113.5149) .. controls (88.9569,113.1268) and (88.9868,112.9311) ..
    (88.4510,113.0674) .. controls (88.2268,113.1244) and (87.6169,113.4648) ..
    (87.8150,113.3453) .. controls (104.0329,103.5597) and (97.5781,106.7800) ..
    (94.8982,109.6313) .. controls (91.6491,114.4227) and (89.9636,120.1187) ..
    (87.5922,125.3542) .. controls (85.2469,131.3456) and (82.8063,137.4348) ..
    (81.9777,143.8564) .. controls (82.0005,145.9182) and (81.9287,148.0175) ..
    (82.3174,150.0505) .. controls (82.9549,151.9974) and (84.3901,153.1977) ..
    (86.1580,154.1786) .. controls (91.0143,157.1724) and (96.3313,159.3076) ..
    (101.4737,161.7466) .. controls (110.6821,165.7013) and (120.1303,169.4307) ..
    (130.2183,170.2546) .. controls (131.8185,170.3484) and (133.4162,170.5018) ..
    (135.0188,170.5359) .. controls (141.7507,170.6793) and (149.0025,170.1335) ..
    (155.4998,168.3189) .. controls (153.2217,169.7651) and (150.9316,171.1925) ..
    (148.6656,172.6576) .. controls (148.0327,173.0668) and (149.9961,171.9381) ..
    (150.5998,171.4870) .. controls (153.1000,169.6192) and (154.2496,166.6874) ..
    (155.3685,163.8914) .. controls (158.4973,155.6858) and (161.0681,147.2577) ..
    (163.0556,138.7038) .. controls (164.1400,132.8491) and (165.3431,126.9654) ..
    (165.3750,120.9809) .. controls (165.4024,115.8497) and (164.4392,110.8158) ..
    (162.9174,105.9344) .. controls (161.3596,102.1109) and (161.2635,101.2517) ..
    (158.9088,97.8821) .. controls (155.4441,92.9243) and (150.7080,89.0177) ..
    (145.9339,85.3947) .. controls (140.5588,81.5211) and (134.9074,77.7903) ..
    (128.5613,75.7188) .. controls (125.7797,74.9765) and (122.9803,74.6423) ..
    (120.1219,75.1830) .. controls (116.5021,75.9711) and (113.1933,77.6751) ..
    (109.9323,79.3871) .. controls (111.9018,78.2073) and (113.8809,77.0436) ..
    (115.8407,75.8479) .. controls (117.0603,75.1037) and (113.3688,77.2821) ..
    (112.1528,78.0323) .. controls (105.9947,81.8315) and (100.0660,86.0176) ..
    (94.4043,90.5211) .. controls (91.0018,93.4299) and (89.0288,94.9866) ..
    (85.9001,98.1693) .. controls (81.1662,102.9850) and (77.0593,108.4125) ..
    (73.7619,114.3050) .. controls (70.1189,121.3474) and (67.0693,128.7008) ..
    (65.1476,136.4129) .. controls (63.7753,141.2732) and (62.4014,146.1413) ..
    (60.5056,150.8305) .. controls (60.5056,150.8305) and (50.4060,155.6110) ..
    (50.4060,155.6110) -- cycle;

\end{tikzpicture}
\end{document}

墨景

相关内容