在 tikzpicture 中将“cm”设置为默认度量单位 2024-5-23 • tikz-pgf tikz-styles 有没有办法避免在 tikzpicture 代码的每一行中手动设置度量单位?例如,有没有办法只写xshift=+3而不是xshift=+3cm? 答案1 编写你自己的班次 \documentclass[tikz]{standalone} \begin{document} \begin{tikzpicture}[myx/.style={xshift=#1*1cm}, myy/.style={yshift=#1*1cm}] \draw[style=help lines] (-2,-2) grid[step=1] (1,1); \draw ([myx=-1,myy=-1]0,0) -- (0,0); \end{tikzpicture} \end{document} 答案2 您可以使用 shift={(3,0)} 代替xshift=3cm。 它并不太冗长,但它确实意味着如果你改变单位向量,偏移也会改变。 \documentclass{article} \usepackage{tikz} \begin{document} \begin{tikzpicture} \draw [shift={(-0.5,-0.5)}] (0,0) grid (4,1); \node {a}; \node [shift={(3,0)}] {b}; \end{tikzpicture} \end{document} 相关内容 为什么“manpath”有效而“echo $MANPATH”无效? 无法访问 /var/www 子目录中的页面 为什么使用 find -exec 删除目录会生成错误消息? 552 user@domain 被列入黑名单!回复 Mail From 命令 双引导 Windows 10 和 Fedora 30 的引导加载程序问题 如何才能精确测量我的服务器上每个网站所消耗的资源? Premiere Pro:如何设置像素完美的矩形蒙版的大小和位置? 在 Ubuntu 服务器上运行 apt-get install 时出错 蓝牙连接无法与新的音频/视频接收器配合使用 将闪存驱动器转换为硬盘驱动器