1

I use the gb4e package to make numbered examples. I'm wanting to include a tabular environment within the example, where the example number is aligned with the first row of the table. If I use a regular tabular environment or tabularray's tblr environment, this works fine, and looks like this:

First row aligned with number

However, if I try to change it to a longtblr environment to allow the table to break across pages, the first row is below the example number:

First row below number

I've tried changing the alignment option to things other than [t], and set all the tblr template parameters to empty or 0 that might affect the spacing, such as presep or headsep, but nothing seems to get rid of the space. How do I make a longtblr environment look like example (1) rather than example (2)?

Here you can find a minimal working example that creates both environments:

\documentclass{article}

\usepackage{tabularray}

\usepackage{gb4e}

\noautomath

\NewTblrTheme{example}{
  \SetTblrTemplate{caption}{empty}
  \SetTblrTemplate{contfoot}{empty}
  \SetTblrTemplate{conthead}{empty}
  \SetTblrTemplate{head}{empty}
  \SetTblrTemplate{foot}{empty}
  \SetTblrTemplate{headsep}{0}
  \SetTblrTemplate{presep}{0}
  \SetTblrTemplate{footsep}{0}
  \SetTblrTemplate{postsep}{0}
  \SetTblrTemplate{remark}{empty}
  \SetTblrTemplate{note}{empty}
}

\NewTblrEnviron{exetblr} 
\SetTblrOuter[exetblr]{
  theme=example,
  l,
  long
}


\begin{document}

\begin{exe}
    \ex
    \begin{tblr}[t]{l l }
        test & test \\
        test & test \\
        test & test \\
    \end{tblr}
\end{exe}

\begin{exe}
    \ex
    \begin{exetblr}[t]{l l}
        test & test \\
        test & test \\
        test & test \\
    \end{exetblr}
\end{exe}

\end{document}

Thanks for the help!

3
  • 1
    welcome! I can see why this happens. when the tblr is long, the package leaves horizontal mode to get the current page total. it also inserts first positive then negative skip. so it is no longer on the current line at all. Commented Sep 4, 2024 at 4:40
  • 1
    if I add negative vertical space at just the right point in the code, I can get the alignment (at least approximately - I may have the value slightly wrong). but I have no idea how to do that in user space right now. Commented Sep 4, 2024 at 5:11
  • Hello! It looks like I can adjust the table up to the correct position with the command \leavevmode\vspace{-3em}. I can either place that to the right of the \ex command to adjust a single table, or include it in the theme declaration to adjust all the tables. Thanks for helping me figure that out! Commented Sep 4, 2024 at 20:49

1 Answer 1

2

As cfr indicated in a comment to the original post, the tblr environment leaves horizontal mode when it is long and inserts a skip, setting the table below the original line. I found that the commands \leavevmode\vspace{-3em} will set the table to the right position. To shift just a single table up, I put this to right of the \ex command:

\begin{exe}
    \ex \leavevmode\vspace{-3em}
    \begin{exetblr}[t]{l l}
        test & test \\
        test & test \\
        test & test \\
    \end{exetblr}
\end{exe}

Or I can change every table by adding it to the table theme:

\NewTblrTheme{example}{
  \leavevmode\vspace{-3em}
}
1
  • 1
    glad you sorted it! just watch in case it causes any untoward effects. (but probably not if your usage is fairly consistent, I guess.) you could try reporting this and requesting an option/version which avoids this problem. Commented Sep 4, 2024 at 23:48

You must log in to answer this question.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.