指定列类型时不显示列线(使用 pgfplotstable)

指定列类型时不显示列线(使用 pgfplotstable)

我需要帮助。我花了几个小时试图解决这个问题,但我不知道问题出在哪里。我是 pgfplotstable 的新手,但对 LaTeX 并不陌生,但我的能力肯定已经到了极限。任何帮助都非常感谢。

我必须编写一份报告,然后根据几个不同客户的要求重新格式化它。其中一个客户要求所有表格都绘制所有单元格边界,但其他客户则不要求。我决定使用 pgfplotstable,因为它能够设置全局选项,我可以将这些选项合并到我的各种 .cls 文件中。不幸的是,当我定义列类型对齐(l、r、p{} 等)时,修饰符 ( column type/.add={|}{}) 似乎不起作用。无论是在 的全局选项中编写\pgfplotstableset还是在单个表下使用编写,都是如此\pgfplotstabletypeset

我尝试的最小工作示例如下:

\documentclass{article}
\usepackage{pgfplotstable} 

\pgfplotstableset{ %for Client1
    every head row/.style={
        before row=\hline},
    after row={\hline},
    col sep = &,
    row sep=\\,
    string type,
    column type/.add={|}{}, %The client has requested every cell have lines.
    every last column/.style={column type/.add={}{|}},
}

\begin{document}

    \begin{table}[htb!]
        \centering
        \caption{This table should have vertical lines around every cell, but doesn't.} 
        \pgfplotstabletypeset[
        columns/Task/.style={column type={l}},
        columns/Objective/.style={column type={p{8cm}}},
        ]{
            Task    &   Objective \\ 
            1 & This a work description of Task 1, and as such contains several sentences of text that must wrap within the cell. \\
            2 & This a work description of Task 2, and as such contains several sentences of text that must wrap within the cell. \\
            3 & This a work description of Task 3, and as such contains several sentences of text that must wrap within the cell. \\
        }
    \end{table}


    \begin{table}[htb!]
        \centering
        \caption{This table has the default column alignment and the global options apply correctly.} 
        \pgfplotstabletypeset[]{
            Task    &   Objective \\ 
            1       &   Short text that does not wrap \\
            2       &   Short text that does not wrap \\
        }
    \end{table}

\end{document}

我是否遗漏了某些显而易见的东西?提前致谢!

相关内容