带居中的图形环境未居中小比例的 Tikz 图片

带居中的图形环境未居中小比例的 Tikz 图片

我搜索了很多,并看到此资源上的许多答案都建议为此目的使用环境figurecentering但结果是图片向右移动了很远。为什么?

\documentclass{article}
\usepackage{tikz}
\begin{document}

test lead line test lead line test lead line test lead line test lead line test lead line test lead line test lead line test lead line test lead line test lead line.

    \tikzstyle{my} = [
        line width=2pt,
        black,
        rounded corners,
    ]

    \begin{figure}[!htbp]
    \centering
    \begin{tikzpicture}[scale=1, everynode/.style={transform shape}, transform canvas={scale=0.2}]
    \draw[my]
        (1,0) -- (10,2)
        ;
    \end{tikzpicture}
    \end{figure}

    test trail line test trail line test trail line test trail line test trail line test trail line test trail line test trail line test trail line test trail line.

    \end{document}

我尝试了有和没有everynode/.style={transform shape},结果是一样的:

定心

相关内容