Standalone picture with Tikz gets an extra white space
Standalone picture with Tikz gets an extra white space
I am trying to play with Tikz, to create standalone
figures, with the snippet below:
standalone
documentclassstandalone
usepackage[utf8]inputenc
usepackagetikz
begindocument
definecolorcff0000RGB255,0,0
begintikzpicture[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;
endtikzpicture
enddocument
Much to my surprise, the left-side of figure gets an added extra white space.
Note: This MWE is created with tikz
extension in inkscape
.
tikz
inkscape
@hpekristiansen Ok got it, thanks.
– Raaja
Aug 21 at 7:24
2 Answers
2
It is called "spurious space", which, in TeX, is usually caused by un-commented line endings.
As a remedy, comment out the line ending in question:
definecolorcff0000RGB255,0,0% <-- `%' added
The standalone package has a dedicated tikz
option that creates a single image per tikzpicture environment
and crop the borders.
tikz
tikzpicture environment
page 8 of the manual:
The standalone class will crop the resulting output file (PDF or
DVI/PS) to the content size plus a certain border. Page number and
other header or footer material will be suppressed. For pictures drawn
with TikZ a dedicated tikz option is provided which loads the tikz
package and also configures the tikzpicture environment to create a
single cropped page.
To add a 5 mm wide border, just add the border option like this :
documentclass[tikz,border=5mm]standalone
documentclass[tikz,border=5mm]standalone
The code without border is :
documentclass[tikz]standalone
usepackage[utf8]inputenc
begindocument
definecolorcff0000RGB255,0,0
begintikzpicture[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;
endtikzpicture
enddocument
+1 but the other answer was much simpler, hence, accepted it.
– Raaja
Aug 21 at 8:04
Alex's answer is not simpler, it is better because it explains why this space is there, which I didn't know.
– AndréC
Aug 21 at 8:19
By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.
tex.stackexchange.com/questions/43621/…
– hpekristiansen
Aug 21 at 7:22