我正在尝试绘制一个小括号。例如,LaTeX 代码如下:
\documentclass{article}
\usepackage{tikz}
\usetikzlibrary{decorations.pathreplacing}
\begin{document}
\begin{tikzpicture}
\draw[decorate,decoration={brace,mirror}] (0,0) -- (0,0.1);
\end{tikzpicture}
\end{document}
但我得到的都是这样的(放大后):
我该如何处理它?
答案1
问题是你的支架也小。您可以将其绘制成合理的大小并重新缩放。例如,参见正确缩放 tikzpicture. 以下代码似乎有效
\documentclass{article}
\usepackage{tikz}
\usetikzlibrary{decorations.pathreplacing}
\tikzset{
% see http://www.texample.net/tikz/examples/pgf-version-2/
dot/.style={fill=black,circle,minimum size=1pt,inner sep=0},
}
\pagestyle{empty}
\begin{document}
\begin{tikzpicture}
\node[dot] at (-0.1,0) {};
\begin{pgflowlevelscope}{\pgftransformscale{0.1}}
\draw[decorate,decoration={brace,mirror}] (0,0) -- (0,1);
\end{pgflowlevelscope}
\node[dot] at (-0.1,.1) {};
\end{tikzpicture}
\end{document}
答案2
我希望您意识到您的支架(装饰路径)只有一毫米长。这太小了!
不过,你可以减少amplitude
以获得更好的结果,即
decoration={brace, mirror, amplitude=+.6pt}
代码
\documentclass[tikz]{standalone}
\usetikzlibrary{decorations.pathreplacing}
\begin{document}
\foreach \lw in {ultra thin, very thin, thin}{% linewidth: .1pt, .2pt, .4pt
\begin{tikzpicture}[\lw]
\draw[decoration={brace,mirror}] \foreach \amp in {0,.1,.2,.3,.4,.5,.6,.7,.8,.9,1} {
[/pgf/decoration/amplitude=\amp pt] (\amp,0) decorate {-- ++(up:.1)}
node [above,scale=.4] {\tiny\amp}};
\draw[ultra thin] (-.1,0) -- + (left:.02) |- +(up:.1)
node[scale=.4, left, pos=.25, inner sep=+1pt] {\tiny1\,mm};
\end{tikzpicture}}
\end{document}
输出