Skip to content

Line break command ignored within frame in beamerarticle #632

Closed

Description

@ysalmon

I have a tblr with a multiline cell, but the \\ line breaking command seems ignored when in a frame environment in a beamerarticle :

\documentclass{article}
\usepackage{beamerarticle}
\usepackage{tabularray}

\begin{document}
\begin{frame}
\begin{tblr}{hlines, vlines,
             columns={halign=c, valign=m, font=\scriptsize, colsep=4pt},
             column{1}={wd=4em}}
{$L_1.L_2$ \\ \tiny non vides}  \\
\end{tblr}
\end{frame}
\end{document}

gives

Image

If I remove the frame environment, I correctly get

Image

Of course the frame is there because my real example is from a larger presentation of which I am doing the article counterpart. Adding [fragile] does not help.

In the beamer version of the document, the line break is where I want it, but that may be by chance (it seems the line break happens "naturally" where LaTeX wants to put it, and not where I request it).

Activity

  1. ponte-vecchio commented on Apr 26, 2026

    @ponte-vecchio
    Member

    I suspect there's an interplay between the value of the designated wd, and the size of the font.

    Consider the following example that explores different font sizes and whether the wd is given or not:

    Details
    \documentclass{article}
    \usepackage{beamerarticle}
    \usepackage{tabularray}
    
    \begin{document}
      \begin{frame}
        \begin{tblr}{
            hlines, vlines,
            columns={c,m,colsep=4pt, font=\small}
        }
          {$L_1 \cdot L_2$ \\ {\tiny non vides}}  \\
        \end{tblr}
        \begin{tblr}{
            hlines, vlines,
            columns={c,m,colsep=4pt, font=\footnotesize}
          }
          {$L_1 \cdot L_2$ \\ {\tiny non vides}}  \\
        \end{tblr}
        \begin{tblr}{
            hlines, vlines,
            columns={c,m,colsep=4pt, font=\tiny}
          }
          {$L_1 \cdot L_2$ \\ {\tiny non vides}}  \\
        \end{tblr}
      \end{frame}
      
      %---
      
      \begin{frame}
        \begin{tblr}{
            hlines, vlines,
            columns={c,m,4em,colsep=4pt, font=\small}
          }
          {$L_1 \cdot L_2$ \\ {\tiny non vides}}  \\
        \end{tblr}
        \begin{tblr}{
            hlines, vlines,
            columns={c,m,4em,colsep=4pt, font=\footnotesize}
          }
          {$L_1 \cdot L_2$ \\ {\tiny non vides}}  \\
        \end{tblr}
        \begin{tblr}{
            hlines, vlines,
            columns={c,m,4em,colsep=4pt, font=\tiny}
          }
          {$L_1 \cdot L_2$ \\ {\tiny non vides}}  \\
        \end{tblr}
      \end{frame}
    \end{document}

    The following output is given:

    Image
  2. added
    BugAn established bug
    Needs InvestigationFurther investigation is warranted to implement the feature/surmise the root cause of the bug.
    on Apr 26, 2026
  3. self-assigned this
    on Apr 26, 2026
  4. muzimuzhi commented on Apr 26, 2026

    @muzimuzhi
    Contributor

    The article mode of beamer ignores \\, see texdoc beamer, sec. 21.2.1 "Starting the Article Mode":

    There is one command whose behavior is a bit special in article mode: The line break command \\. Inside frames, this command has no effect in article mode, except if an overlay specification is present. Then it has the normal effect dictated by the specification. The reason for this behavior is that you will typically inserts lots of \\ commands in a presentation in order to get control over all line breaks. These line breaks are mostly superfluous in article mode. If you really want a line break to apply in all versions, say \\<all>. Note that the command \\ is often redefined by certain environments, so it may not always be overlay-specification-aware. In such a case you have to write something like \only<presentation>{\\}.

    In tabularray,

    • the initial setting halign=j lets \\ to \@normalcr (see \__tblr_halign_command_j:, then \TblrAlignBoth), which is not altered by beamerarticle, so with haligh=j, \\ works inside tblr cells;
    • by setting halign=c (OP's columns={c, ...} is a shortcut), \\ is let to \@centercr (see \__tblr_halign_command_c:, then \TblrAlignCenter and \centering), which unfortunately is altered by beamerarticle, so with haligh=c, \\ is ignored inside tblr cells. One needs to use \\<all> or setting something like columns={preto={\let\\=\beamer@origbreakcenter}}.

    tabularray/tabularray.sty

    Lines 171 to 175 in 6fe650f

    %% Some commands for horizontal alignment
    \cs_new_eq:NN \__tblr_halign_command_j: \TblrAlignBoth
    \cs_new_eq:NN \__tblr_halign_command_l: \TblrAlignLeft
    \cs_new_eq:NN \__tblr_halign_command_c: \TblrAlignCenter
    \cs_new_eq:NN \__tblr_halign_command_r: \TblrAlignRight

    \NewDocumentCommand \TblrAlignBoth { }
    {
    \let \\ = \@normalcr
    \leftskip = \z@skip
    \@rightskip = \z@skip
    \rightskip = \@rightskip
    \parfillskip = \@flushglue
    }
    \NewDocumentCommand \TblrAlignLeft { } { \raggedright }
    \NewDocumentCommand \TblrAlignCenter { } { \centering }
    \NewDocumentCommand \TblrAlignRight { } { \raggedleft }

    Example

    \documentclass{article}
    \usepackage{beamerarticle}
    \usepackage{tabularray}
    
    \NewDocumentCommand{\testTblrLinebreak}{mm}{
      \begin{tblr}{
          hlines, vlines,
          columns={#1}
        }
        {$L_1 \cdot L_2$ #2 {\tiny non vides}}  \\
      \end{tblr}
      \parbox{15em}{\tiny\ttfamily\frenchspacing\raggedright\sloppy
        options: "\detokenize{columns={#1}}" \newline
        linebreak command: "\detokenize{#2}"
      }
    }
    
    \begin{document}
    \begin{frame}
      % failing cases
      \testTblrLinebreak{halign=c, 8em}{\\}
    
      % working cases
      \testTblrLinebreak{halign=j, 8em}{\\} % `j` is the default haligh
    
      \testTblrLinebreak{halign=c, 8em}{\\<all>}
    
      \makeatletter
      \def\tblrResetCentercr{%
        \let\\=\beamer@origbreakcenter
      }
      \makeatother
      \testTblrLinebreak{halign=c, 8em, preto=\tblrResetCentercr}{\\}
    \end{frame}
    \end{document}

    Output

    Image
  5. ysalmon commented on Apr 26, 2026

    @ysalmon
    Author

    Thank you so much for this in-depth investigation !

    Maybe this setting should be done by tblarray, as the rationale of beamerarticle's behaviour with line breaks does not apply within table cells.

  6. added this to the 2026A milestone on Apr 29, 2026
  7. linked a pull request that will close this issueFinalize the 2026A sources #657on May 13, 2026
  8. added
    Fixed in devThe raised concern is addressed in the dev branch, awaiting release.
    and removed
    Needs InvestigationFurther investigation is warranted to implement the feature/surmise the root cause of the bug.
    on May 16, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

BugAn established bugFixed in devThe raised concern is addressed in the dev branch, awaiting release.

Type

No type

Projects

No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions