相邻 tikz 矩形的线条粗细渲染问题

相邻 tikz 矩形的线条粗细渲染问题

我想创建多个带有文本的矩形框。这些框应该彼此相邻,并且所有行的粗细应该相同(我想我可以使用下面的 MWE 表格来实现相同的效果,但是对于更复杂的应用程序,表格是不够的)。我正在使用该tikz包。下面是 MWE 代码片段:

\documentclass[12pt,a4paper]{article}

\usepackage[margin=2cm]{geometry}
\usepackage{tikz}

\begin{document}
            
\begin{tikzpicture}

\begin{scope}[
    fieldbox/.style={rectangle,draw,minimum height=1.5cm, thick, outer sep = 0pt, anchor=south west}
]
\node[fieldbox,minimum width=2.5cm] (box1) at (0,0) {Box 1};
\node[fieldbox,minimum width=2cm] (box2) at (box1.south east) {Box 2};
\node[fieldbox,minimum width=3cm] (box3) at (box2.south east) {Box 3};
\end{scope}

\end{tikzpicture}  

\end{document}

当使用 Adob​​e Reader 查看生成的 pdf 文件时,它看起来很好: 在此处输入图片描述

但是,当我将缩放级别增加到“页面宽度”时(许多读者可能会这样做),线条粗细不再均匀,并且某些线条看起来是双重的: 在此处输入图片描述

我以前在 Latex 中遇到过类似的表格问题,有人告诉我这是 pdf 查看器的渲染器的问题。然而结果并不是最佳的。有没有办法让所有线条的粗细都相同,而不管 pdf 查看器的缩放级别如何?

如果没有办法解决这个问题,是否有其他方法来绘制带有文本的相邻框tikz

更新:

我还尝试了另一种实现方式。不幸的是,在这种情况下,某些垂直线在某些缩放级别下仍然显得更粗。这确实支持了上面@MDescamps 的回应,即这是一个渲染问题:

\documentclass[12pt,a4paper]{article}

\usepackage[margin=2cm]{geometry}
\usepackage{tikz}
\usetikzlibrary{matrix}

\begin{document}

\begin{tikzpicture}
    \matrix(dict)[matrix of nodes,
        nodes={align=center, inner sep = 0pt},
        row 1/.style={minimum height=1.5cm, text height = 1em, text depth = 0.2em},
        column 1/.style={nodes={text width=2.5cm}},
        column 2/.style={nodes={text width=2cm}},
        column 3/.style={nodes={text width=3cm}},
    ]{
        Box 1 & Box 2 & Box 3 \\
    };
    \draw[thick, line cap=rect](dict-1-1.north west)--(dict-1-3.north east);
    \draw[thick, line cap=rect](dict-1-1.south west)--(dict-1-3.south east);
    \draw[thick](dict-1-1.north west)--(dict-1-1.south west);
    \draw[thick](dict-1-1.north east)--(dict-1-1.south east);
    \draw[thick](dict-1-2.north east)--(dict-1-2.south east);
    \draw[thick](dict-1-3.north east)--(dict-1-3.south east);
\end{tikzpicture}

\end{document}

相关内容