使用不同颜色自定义预定义符号

使用不同颜色自定义预定义符号

例如我有这个代码

\documentclass[a4paper,12pt]{article}
\usepackage{xcolor}
\usepackage{manfnt}
\begin{document}
   \color{red}{\textdbend} 
\end{document}

产生以下输出:

在此处输入图片描述

默认情况下它是黑色的,但如果我添加红色,默认符号当然会变成全单色。是否可以随意为符号的部分着色(例如,我想要黑色曲线符号)还是无法实现,因为符号只有一种颜色?

答案1

在 tikz 中重新创建符号

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

\begin{document}    

\begin{tikzpicture}[y=0.80pt, x=0.80pt, yscale=1.000000, xscale=1.000000, inner sep=0pt, outer sep=0pt]
\path[fill=red,nonzero rule] (6.3749,6.9704) .. controls (4.7212,7.2843) and (4.5592,7.3197) .. (4.3843,7.4055) .. controls (4.0676,7.5611) and (3.8515,7.8680) .. (3.7877,8.2528) .. controls (3.7023,8.7678) and (3.9833,9.3370) .. (4.4429,9.5803) .. controls (4.5299,9.6263) and (5.4053,9.9636) .. (6.3882,10.3299) .. controls (8.2627,11.0284) and (8.3312,11.0594) .. (8.2662,11.1809) .. controls (8.2507,11.2099) and (8.2238,11.2387) .. (8.2065,11.2449) .. controls (8.1893,11.2510) and (7.4079,11.3988) .. (6.4699,11.5732) .. controls (5.5320,11.7478) and (4.7547,11.9006) .. (4.7426,11.9126) .. controls (4.7244,11.9307) and (4.8785,12.8367) .. (4.9182,12.9450) .. controls (4.9249,12.9632) and (4.9515,12.9780) .. (4.9772,12.9780) .. controls (5.0702,12.9780) and (8.5321,12.3141) .. (8.6427,12.2751) .. controls (8.9308,12.1733) and (9.1463,11.9749) .. (9.2820,11.6856) .. controls (9.3543,11.5319) and (9.3666,11.4736) .. (9.3754,11.2408) .. controls (9.3866,10.9470) and (9.3502,10.7714) .. (9.2289,10.5317) .. controls (9.1453,10.3668) and (8.9056,10.1277) .. (8.7312,10.0350) .. controls (8.6584,9.9965) and (7.7790,9.6583) .. (6.7770,9.2838) .. controls (4.8617,8.5679) and (4.8352,8.5559) .. (4.9029,8.4292) .. controls (4.9182,8.4007) and (4.9578,8.3713) .. (4.9909,8.3637) .. controls (5.0240,8.3561) and (5.8060,8.2094) .. (6.7286,8.0377) .. controls (7.9718,7.8063) and (8.4098,7.7154) .. (8.4209,7.6863) .. controls (8.4398,7.6371) and (8.2709,6.7019) .. (8.2349,6.6571) .. controls (8.2203,6.6389) and (8.2010,6.6252) .. (8.1918,6.6264) .. controls (8.1827,6.6278) and (7.3651,6.7825) .. (6.3749,6.9704) -- cycle;
\path[fill=black,nonzero rule] (2.9788,1.1320) .. controls (2.9070,1.1823) and (2.8982,1.3310) .. (2.9636,1.3854) .. controls (2.9992,1.4150) and (3.2874,1.4242) .. (4.4926,1.4349) -- (5.9778,1.4482) -- (5.9851,2.9175) .. controls (5.9891,3.7257) and (5.9866,4.4109) .. (5.9796,4.4401) .. controls (5.9726,4.4695) and (5.9275,4.5157) .. (5.8796,4.5431) .. controls (5.7310,4.6278) and (1.4490,8.9183) .. (1.3190,9.1127) .. controls (1.0264,9.5502) and (1.0150,9.9999) .. (1.2846,10.4611) .. controls (1.3465,10.5670) and (1.9340,11.1744) .. (3.3697,12.6168) .. controls (5.1044,14.3593) and (5.5519,14.7965) .. (5.9182,15.1076) -- (5.9910,15.1694) -- (5.9910,15.6051) .. controls (5.9910,15.9937) and (5.9963,16.0457) .. (6.0394,16.0849) .. controls (6.0809,16.1224) and (6.1599,16.1286) .. (6.5913,16.1286) .. controls (7.0455,16.1286) and (7.0991,16.1239) .. (7.1386,16.0802) .. controls (7.1757,16.0392) and (7.1824,15.9641) .. (7.1824,15.5912) -- (7.1824,15.1506) -- (7.3214,15.0464) .. controls (7.3978,14.9890) and (8.4386,13.9611) .. (9.6341,12.7621) .. controls (11.2725,11.1191) and (11.8311,10.5430) .. (11.9020,10.4232) .. controls (12.0409,10.1887) and (12.0898,9.9930) .. (12.0738,9.7362) .. controls (12.0568,9.4660) and (11.9642,9.2540) .. (11.7434,8.9803) .. controls (11.5323,8.7186) and (7.4364,4.6376) .. (7.3081,4.5609) .. controls (7.2534,4.5284) and (7.2025,4.4758) .. (7.1949,4.4443) .. controls (7.1872,4.4128) and (7.1843,3.7257) .. (7.1883,2.9175) -- (7.1956,1.4482) -- (8.6809,1.4349) .. controls (10.3095,1.4205) and (10.2535,1.4267) .. (10.2535,1.2612) .. controls (10.2535,1.0782) and (10.5239,1.0908) .. (6.5867,1.0908) .. controls (3.4173,1.0908) and (3.0313,1.0952) .. (2.9788,1.1320) -- cycle(6.8515,2.8778) -- (6.8515,4.3075) -- (6.3220,4.3075) -- (6.3151,2.9043) .. controls (6.3113,2.1327) and (6.3141,1.4858) .. (6.3213,1.4671) .. controls (6.3309,1.4418) and (6.4008,1.4349) .. (6.5929,1.4406) -- (6.8515,1.4482) -- cycle(6.9668,4.7456) .. controls (7.1285,4.8237) and (7.3157,5.0033) .. (9.2954,6.9783) .. controls (10.8544,8.5335) and (11.4834,9.1782) .. (11.5756,9.3153) .. controls (11.7885,9.6313) and (11.8081,9.8461) .. (11.6544,10.1735) .. controls (11.5807,10.3301) and (11.3956,10.5226) .. (9.3584,12.5623) .. controls (7.2835,14.6399) and (7.1307,14.7869) .. (6.9549,14.8743) .. controls (6.7973,14.9526) and (6.7385,14.9678) .. (6.5888,14.9686) .. controls (6.4353,14.9696) and (6.3819,14.9558) .. (6.2074,14.8706) .. controls (6.0109,14.7748) and (5.9370,14.7044) .. (3.9562,12.7297) .. controls (2.8296,11.6067) and (1.8343,10.6027) .. (1.7443,10.4983) .. controls (1.5092,10.2260) and (1.4258,10.0473) .. (1.4248,9.8137) .. controls (1.4242,9.6558) and (1.4375,9.6001) .. (1.5136,9.4431) .. controls (1.5976,9.2698) and (1.7363,9.1248) .. (3.7640,7.0930) .. controls (4.9524,5.9020) and (5.9869,4.8848) .. (6.0629,4.8323) .. controls (6.3745,4.6169) and (6.6468,4.5907) .. (6.9668,4.7456) -- cycle(6.8592,15.5181) .. controls (6.8641,15.6564) and (6.8556,15.7502) .. (6.8361,15.7738) .. controls (6.7963,15.8216) and (6.3874,15.8262) .. (6.3404,15.7792) .. controls (6.3111,15.7496) and (6.2927,15.3327) .. (6.3197,15.3056) .. controls (6.3258,15.2996) and (6.4478,15.2957) .. (6.5911,15.2971) -- (6.8515,15.2996) -- cycle;
\end{tikzpicture}
\end{document}

在此处输入图片描述

答案2

\clipbox黑色符号并叠加在红色上。适用于 10-12pt 文档以及较小的文本尺寸。

\documentclass{article}
\usepackage{xcolor}
\usepackage{manfnt,stackengine,trimclip}
\newcommand\textdbendrb{\setbox0=\hbox{%
  \rotatebox[origin=lb]{-12}{\rule{0.70ex}{0ex}%
  \clipbox{1.17ex 1.98ex 1.35ex 1.18ex}{%
  \rotatebox[origin=lb]{12}{\textdbend}}}}%
  \stackengine{2.03ex}{\textcolor{red}{\textdbend}}{\copy0}{O}{l}{F}{F}{L}%
}
\begin{document}
\textdbend \textdbendrb
\end{document}

在此处输入图片描述

补充

对于那些像 Sebastiano 一样精明的人来说,他们注意到,在不同的放大倍数下,黑色双弯的边缘会出现一个红色阴影,他们可以采取额外的步骤,首先用 遮住红色双弯,\rule然后然后覆盖黑色双弯:

\documentclass[12pt]{article}
\usepackage{xcolor}
\usepackage{manfnt,stackengine,trimclip}
\newcommand\textdbendrb{\setbox0=\hbox{%
  \rotatebox[origin=lb]{-12}{\rule{0.70ex}{0ex}%
  \clipbox{1.17ex 1.98ex 1.35ex 1.18ex}{%
  \rotatebox[origin=lb]{12}{\textdbend}}}}%
  \stackengine{2.03ex}{%
    \stackengine{1.5ex}{\color{red}\textdbend}{\rotatebox[origin=c]{45}{%
      \color{white}\rule{2.1ex}{2.1ex}}}{O}{c}{F}{T}{L}%
  }{\copy0}{O}{l}{F}{F}{L}%
}
\begin{document}
\textdbend \textdbendrb

\tiny\textdbend \textdbendrb
\end{document}

正如我向 OP 指出的那样,如果您在此 MWE 中将声明更改\color{white}为例如,\color{yellow}您可以直观地看到我在覆盖黑色双弯之前首先从红色标志中抹去的区域。

答案3

将符号作为图像包含:

在此处输入图片描述

\documentclass[a4paper,12pt]{article}
\usepackage{graphicx}
\begin{document}
X \includegraphics[height=2ex]{bend} X
\end{document}

在此处输入图片描述

相关内容