将 SVG 绘图转换为符号

将 SVG 绘图转换为符号

我有以下 SVG 图形,我想将其转换为标准符号。我可以这样做吗?我不怕使用命令行工具。

<svg version="1.1" xmlns="http://www.w3.org/2000/svg" width="512px" height="512px"><path d="M248.6812286,433.4931641v20.0522461h-52.7408752l-17.4946594-60.7532349c-12.177536-3.1057129-24.2567749-7.7471924-36.0391541-14.0788269l-59.4142914,34.7086487l-35.3576393-35.3576355l32.1224251-60.0131531c-6.2860947-11.0388489-11.1512985-22.7107239-14.5720825-34.7373352L0,265.6073608V215.517334l64.8365021-19.0444641c3.3286667-12.0869446,8.0897217-23.8344116,14.3008194-34.9476929l-32.9759216-58.9558868L81.519043,67.2115936l59.4282837,33.3822556c11.33638-6.2394028,22.963501-10.9169006,34.6914215-14.1426392l18.3372803-66.8742294h50.0899811l18.8692932,68.2760468c11.0263062,3.375,21.6495056,7.926712,31.6786804,13.5394287l62.400116-35.6540756l35.357666,35.3576431l-35.4750671,62.9934387c4.7478638,8.7266693,8.6967163,18.003006,11.7426453,27.7520599c-16.649353,0.2546997-42.0372314,2.3027496-61.6087952,11.2245178c-20.9090881-51.650589-85.0554047-77.9125061-138.0021973-47.3881073c-64.2331772,37.0311432-64.2331772,130.1116791,0.000061,167.142868c13.7020721,7.8994141,28.1541748,11.9908752,42.4132538,12.8275452C209.0223846,396.2406311,217.3099365,414.9727173,248.6812286,433.4931641z M335.8697205,345.8901062c-22.2559204,0-41.0082092,19.1154175-41.0082092,40.7783203v29.9892273h-22.5706177c-19.0729828,0-30.2190857-13.8449097-34.8784332-33.2810364c-6.2931213-26.1043701-6.026886-41.7041321,0-66.7071838c5.2281342-21.820282,21.9291229-33.2810364,41.0022125-33.2810364h90.2700806v-11.2883301H303.054657v-25.8188019c0-18.9399414,5.0466003-25.4611053,32.821106-30.3624878c21.4404602-3.5894165,43.2973633-3.5507812,65.5574951,0c17.8143616,2.9649963,32.8210754,16.3258362,32.8210754,34.1160126v62.4956665c0,18.3347778-14.5710144,33.3536072-32.8210754,33.3536072L335.8697205,345.8901062z M353.3186035,243.9890289c0-11.6896515-12.5506287-19.0353394-22.5368347-13.1904907c-9.9862671,5.8448029-9.9862671,20.5361938,0,26.3809967C340.7679749,263.0243835,353.3186035,255.6786804,353.3186035,243.9890289z M507.3794556,388.9948425c-5.2281494,21.8202209-21.9291382,33.2809753-41.0021973,33.2809753h-90.2701721v10.2151489h65.6301575l-0.000061,26.8920288c0,18.9398804-5.0466003,25.4610901-32.8210754,30.3624878c-21.4404907,3.5893555-43.2973938,3.5507202-65.5574951-0.000061c-17.8144531-2.9649963-32.821106-16.3258362-32.821106-34.1160278V393.133728c0-18.3347778,14.5710449-33.3536072,32.821106-33.3536072l65.5635986-0.0060425c22.2558899,0.000061,41.0081787-19.1153564,41.0082397-40.7782593v-29.9892273l22.5705566,0.000061c19.072998,0,30.2191162,13.8448792,34.8784485,33.2810059C513.6726074,348.3920593,513.406311,363.9917603,507.3794556,388.9948425z M391.4732666,461.6751709c0,11.6896362,12.5505981,19.0353394,22.5368652,13.1905518c9.9862671-5.8448792,9.9862671-20.5362549,0-26.3810425C404.0238647,442.6398621,391.4732666,449.9855652,391.4732666,461.6751709z"/></svg>

我想输入:

\documentclass[12pt,a4paper]{article}

\def\pylogo{%????%
}

\begin{document}

\pylogo{}

\Large\pylogo{}

\end{document}

答案1

使用svg.path来自的库tikzscalerel包:

在此处输入图片描述

\documentclass{article}

\usepackage{scalerel}
\usepackage{tikz}
\usetikzlibrary{svg.path}

\newcommand\pylogo{\mbox{\scalerel*{
\begin{tikzpicture}[yscale=-1,transform shape]
    \fill [black] svg{M248.6812286,433.4931641v20.0522461h-52.7408752l-17.4946594-60.7532349c-12.177536-3.1057129-24.2567749-7.7471924-36.0391541-14.0788269l-59.4142914,34.7086487l-35.3576393-35.3576355l32.1224251-60.0131531c-6.2860947-11.0388489-11.1512985-22.7107239-14.5720825-34.7373352L0,265.6073608V215.517334l64.8365021-19.0444641c3.3286667-12.0869446,8.0897217-23.8344116,14.3008194-34.9476929l-32.9759216-58.9558868L81.519043,67.2115936l59.4282837,33.3822556c11.33638-6.2394028,22.963501-10.9169006,34.6914215-14.1426392l18.3372803-66.8742294h50.0899811l18.8692932,68.2760468c11.0263062,3.375,21.6495056,7.926712,31.6786804,13.5394287l62.400116-35.6540756l35.357666,35.3576431l-35.4750671,62.9934387c4.7478638,8.7266693,8.6967163,18.003006,11.7426453,27.7520599c-16.649353,0.2546997-42.0372314,2.3027496-61.6087952,11.2245178c-20.9090881-51.650589-85.0554047-77.9125061-138.0021973-47.3881073c-64.2331772,37.0311432-64.2331772,130.1116791,0.000061,167.142868c13.7020721,7.8994141,28.1541748,11.9908752,42.4132538,12.8275452C209.0223846,396.2406311,217.3099365,414.9727173,248.6812286,433.4931641z M335.8697205,345.8901062c-22.2559204,0-41.0082092,19.1154175-41.0082092,40.7783203v29.9892273h-22.5706177c-19.0729828,0-30.2190857-13.8449097-34.8784332-33.2810364c-6.2931213-26.1043701-6.026886-41.7041321,0-66.7071838c5.2281342-21.820282,21.9291229-33.2810364,41.0022125-33.2810364h90.2700806v-11.2883301H303.054657v-25.8188019c0-18.9399414,5.0466003-25.4611053,32.821106-30.3624878c21.4404602-3.5894165,43.2973633-3.5507812,65.5574951,0c17.8143616,2.9649963,32.8210754,16.3258362,32.8210754,34.1160126v62.4956665c0,18.3347778-14.5710144,33.3536072-32.8210754,33.3536072L335.8697205,345.8901062z M353.3186035,243.9890289c0-11.6896515-12.5506287-19.0353394-22.5368347-13.1904907c-9.9862671,5.8448029-9.9862671,20.5361938,0,26.3809967C340.7679749,263.0243835,353.3186035,255.6786804,353.3186035,243.9890289z M507.3794556,388.9948425c-5.2281494,21.8202209-21.9291382,33.2809753-41.0021973,33.2809753h-90.2701721v10.2151489h65.6301575l-0.000061,26.8920288c0,18.9398804-5.0466003,25.4610901-32.8210754,30.3624878c-21.4404907,3.5893555-43.2973938,3.5507202-65.5574951-0.000061c-17.8144531-2.9649963-32.821106-16.3258362-32.821106-34.1160278V393.133728c0-18.3347778,14.5710449-33.3536072,32.821106-33.3536072l65.5635986-0.0060425c22.2558899,0.000061,41.0081787-19.1153564,41.0082397-40.7782593v-29.9892273l22.5705566,0.000061c19.072998,0,30.2191162,13.8448792,34.8784485,33.2810059C513.6726074,348.3920593,513.406311,363.9917603,507.3794556,388.9948425z M391.4732666,461.6751709c0,11.6896362,12.5505981,19.0353394,22.5368652,13.1905518c9.9862671-5.8448792,9.9862671-20.5362549,0-26.3810425C404.0238647,442.6398621,391.4732666,449.9855652,391.4732666,461.6751709z};
\end{tikzpicture}
}{A}}}

\begin{document}

\pylogo{} 

\Large\pylogo{}

\end{document}

你可以将符号缩放到你想要的大小。这里我选择将其缩放到大写字母的大小A

相关内容