![如何使用 TikZ 装饰获得粗体文本?](https://linux22.com/image/472627/%E5%A6%82%E4%BD%95%E4%BD%BF%E7%94%A8%20TikZ%20%E8%A3%85%E9%A5%B0%E8%8E%B7%E5%BE%97%E7%B2%97%E4%BD%93%E6%96%87%E6%9C%AC%EF%BC%9F.png)
梅威瑟:
\documentclass{article}
\usepackage{geometry}
\usepackage{tikz}
\usetikzlibrary{decorations.text}
\tikzset{mydecor/.style 2 args={decoration={text along path,
text align={left indent=2em},
text={|\Large|#2},
},
yshift=#1,
decorate}}
\begin{document}
\thispagestyle{empty}
\begin{tikzpicture}
\fill[brown!65!black] (-6,0) rectangle (6,9) (180:0.45cm) arc (180:360:0.45cm);
\draw[line width=0.3cm,blue,fill=white,miter limit=1]
(0,0.45) to[controls={+(150:2.25cm) and +(25:2.25cm)}] (-5.4,0.6) --
(-5.4,9.6) to[controls={+(25:2.25cm) and +(150:2.25cm)}]
(0,9) to[controls={+(30:2.25cm) and +(155:2.25cm)}] (5.4,9.6) --
(5.4,0.6) to[controls={+(155:2.25cm) and +(30:2.25cm)}]
(0,0.45) -- (0,9);
% Left page
\path[mydecor={-7ex}{Bold text?}] (-5.4,9.6) to[controls={+(25:2.25cm) and +(150:2.25cm)}] (0,9);
% Right page
\path[mydecor={-7ex}{Bold text?}] (0,9) to[controls={+(30:2.25cm) and +(155:2.25cm)}] (5.4,9.6);
\end{tikzpicture}
\end{document}
输出为:
我如何使显示的文本加粗?通常的方法似乎不起作用,除非我没有将命令放在正确的位置。我使用XeLaTeX.
谢谢。
答案1
\bfseries
通过将文本放在...\Large
内,文本将变为粗体。因此。|
|
text={|\Large\bfseries|#2}
\documentclass{article}
\usepackage{geometry}
\usepackage{tikz}
\usetikzlibrary{decorations.text}
\tikzset{mydecor/.style 2 args={decoration={text along path,
text align={left indent=2em},
text={|\Large\bfseries|#2},
},
yshift=#1,
decorate}}
\begin{document}
\thispagestyle{empty}
\begin{tikzpicture}
\fill[brown!65!black] (-6,0) rectangle (6,9) (180:0.45cm) arc (180:360:0.45cm);
\draw[line width=0.3cm,blue,fill=white,miter limit=1]
(0,0.45) to[controls={+(150:2.25cm) and +(25:2.25cm)}] (-5.4,0.6) --
(-5.4,9.6) to[controls={+(25:2.25cm) and +(150:2.25cm)}]
(0,9) to[controls={+(30:2.25cm) and +(155:2.25cm)}] (5.4,9.6) --
(5.4,0.6) to[controls={+(155:2.25cm) and +(30:2.25cm)}]
(0,0.45) -- (0,9);
% Left page
\path[mydecor={-7ex}{Bold text?}] (-5.4,9.6) to[controls={+(25:2.25cm) and +(150:2.25cm)}] (0,9);
% Right page
\path[mydecor={-7ex}{Bold text?}] (0,9) to[controls={+(30:2.25cm) and +(155:2.25cm)}] (5.4,9.6);
\end{tikzpicture}
\end{document}