我使用该tabularray
包制作了一个表格,并在其中插入了一个注释,但它显示的缩进不合适。如何更改注释的缩进以使其与冒号对齐?
\documentclass{article}
\usepackage{tabularray}
\begin{document}
\begin{table}[htbp]
\begin{talltblr}[
caption={table},
remark{Hello}={It is a very long note.It is a very long note.It is a very long note.It is a very long note.It is a very long note.It is a very long note.}
]{
colspec={X[c] *{2}{X[c,2]}}
}
&HI&HI\\
low&$<10$&$<0$\\
me&$20\leq\quad\leq 30$&$40\leq\quad\leq 50$\\
hogh&$>0$&$>50$\\
\end{talltblr}
\end{table}
\end{document}
答案1
笔记:我添加了第二个示例,其中只有一个表使用缩进注释。此示例中还\linewidth
使用了 而不是\textwidth
。
\documentclass{article}
\usepackage{tabularray}
\begin{document}
\newlength\labellength
\DefTblrTemplate{remark}{default}{%
\MapTblrRemarks{%
\settowidth{\labellength}{\UseTblrTemplate{remark-tag}{default}\UseTblrTemplate{remark-sep}{default}}%
\UseTblrTemplate{remark-tag}{default}\UseTblrTemplate{remark-sep}{default}%
\parbox[t]{\dimexpr\textwidth-\labellength}{\UseTblrTemplate{remark-text}{default}}%
\par
}}
\begin{table}[htbp]
\begin{talltblr}[
caption={table},
remark{Hello}={It is a very long note.It is a very long note.It is a very long note.It is a very long note.It is a very long note.It is a very long note.}
]{
colspec={X[c] *{2}{X[c,2]}}
}
&HI&HI\\
low&$<10$&$<0$\\
me&$20\leq\quad\leq 30$&$40\leq\quad\leq 50$\\
hogh&$>0$&$>50$\\
\end{talltblr}
\end{table}
\end{document}
第二个例子:在这里我使用主题,以便您可以选择哪些表使用该解决方案。
\documentclass{article}
\usepackage{tabularray}
\begin{document}
\newlength\labellength
\DefTblrTemplate{remark}{indentednotes}{%
\MapTblrRemarks{%
\settowidth{\labellength}{\UseTblrTemplate{remark-tag}{default}\UseTblrTemplate{remark-sep}{default}}%
\UseTblrTemplate{remark-tag}{default}\UseTblrTemplate{remark-sep}{default}%
\parbox[t]{\dimexpr\linewidth-\labellength}{\UseTblrTemplate{remark-text}{default}}%
\par}
}
\NewTblrTheme{indentednotes}{
\SetTblrTemplate{remark}{indentednotes}
}
\begin{table}[htbp]
\begin{talltblr}[
theme = indentednotes,
caption={table with indented notes},
remark{Hello}={It is a very long note.It is a very long note.It is a very long note.It is a very long note.It is a very long note.It is a very long note.}
]{
colspec={X[c] *{2}{X[c,2]}}
}
&HI&HI\\
low&$<10$&$<0$\\
me&$20\leq\quad\leq 30$&$40\leq\quad\leq 50$\\
hogh&$>0$&$>50$\\
\end{talltblr}
\end{table}
\begin{table}[htbp]
\begin{talltblr}[
caption={table with normal notes},
remark{Hello}={It is a very long note.It is a very long note.It is a very long note.It is a very long note.It is a very long note.It is a very long note.}
]{
colspec={X[c] *{2}{X[c,2]}}
}
&HI&HI\\
low&$<10$&$<0$\\
me&$20\leq\quad\leq 30$&$40\leq\quad\leq 50$\\
hogh&$>0$&$>50$\\
\end{talltblr}
\end{table}
\end{document}