0

I use the tabularray package to make a table, into which I insert a note, but it shows with insuitable indentation. How to change the indentation of the note to make it align with the colon?

\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}

enter image description here

1 Answer 1

4

NOTE: I have added a second example, where only one table uses the indented notes. Also in this example \linewidth is used instead of \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}

enter image description here

Second example: Here I use a theme, so that you can choose which tables use the solution.

\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}
7
  • May you tell me why you know the answer. What should I do to become as good as you about LaTeX?
    – Y. zeng
    May 22, 2022 at 23:23
  • Is there a way to modify the indent width in a table not in all tables?
    – Y. zeng
    May 22, 2022 at 23:25
  • 3
    I think it would be better to replace \textwidth with \linewidth, which will make the solution work for narrower tables.
    – L.J.R.
    May 23, 2022 at 0:44
  • "Is there a way to modify the indent width in a table not in all tables?". Yes, by using a theme. I have added a second example with the theme. May 23, 2022 at 6:23
  • 3
    And why I know the answer? I have been working with LaTeX for more than 30 years. I am curious, and if I don't know something that I need or that I want to know, I read all the necessary documentation, look for answers that others have given and just start experimenting until I get the answer. May 23, 2022 at 6:25

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .