Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Beamer table compilation failure after #9022 #9914

Open
ccaprani opened this issue Jun 25, 2024 · 6 comments
Open

Beamer table compilation failure after #9022 #9914

ccaprani opened this issue Jun 25, 2024 · 6 comments
Labels

Comments

@ccaprani
Copy link

Here is an MWE:

---
title:
- My title
author:
- My name
slide-level: 1
---

# Section

## Subsection

| Col 1 | Col 2 |
|-------|-------|
| data  | data  |

## Subsection

Next slide

Compiling to beamer prior to #9022 gives:

% Options for packages loaded elsewhere
\PassOptionsToPackage{unicode}{hyperref}
\PassOptionsToPackage{hyphens}{url}
%
\documentclass[
  ignorenonframetext,
]{beamer}
\usepackage{pgfpages}
\setbeamertemplate{caption}[numbered]
\setbeamertemplate{caption label separator}{: }
\setbeamercolor{caption name}{fg=normal text.fg}
\beamertemplatenavigationsymbolsempty
% Prevent slide breaks in the middle of a paragraph
\widowpenalties 1 10000
\raggedbottom
\setbeamertemplate{part page}{
  \centering
  \begin{beamercolorbox}[sep=16pt,center]{part title}
    \usebeamerfont{part title}\insertpart\par
  \end{beamercolorbox}
}
\setbeamertemplate{section page}{
  \centering
  \begin{beamercolorbox}[sep=12pt,center]{part title}
    \usebeamerfont{section title}\insertsection\par
  \end{beamercolorbox}
}
\setbeamertemplate{subsection page}{
  \centering
  \begin{beamercolorbox}[sep=8pt,center]{part title}
    \usebeamerfont{subsection title}\insertsubsection\par
  \end{beamercolorbox}
}
\AtBeginPart{
  \frame{\partpage}
}
\AtBeginSection{
  \ifbibliography
  \else
    \frame{\sectionpage}
  \fi
}
\AtBeginSubsection{
  \frame{\subsectionpage}
}
\usepackage{amsmath,amssymb}
\usepackage{iftex}
\ifPDFTeX
  \usepackage[T1]{fontenc}
  \usepackage[utf8]{inputenc}
  \usepackage{textcomp} % provide euro and other symbols
\else % if luatex or xetex
  \usepackage{unicode-math} % this also loads fontspec
  \defaultfontfeatures{Scale=MatchLowercase}
  \defaultfontfeatures[\rmfamily]{Ligatures=TeX,Scale=1}
\fi
\usepackage{lmodern}
\ifPDFTeX\else
  % xetex/luatex font selection
\fi
% Use upquote if available, for straight quotes in verbatim environments
\IfFileExists{upquote.sty}{\usepackage{upquote}}{}
\IfFileExists{microtype.sty}{% use microtype if available
  \usepackage[]{microtype}
  \UseMicrotypeSet[protrusion]{basicmath} % disable protrusion for tt fonts
}{}
\makeatletter
\@ifundefined{KOMAClassName}{% if non-KOMA class
  \IfFileExists{parskip.sty}{%
    \usepackage{parskip}
  }{% else
    \setlength{\parindent}{0pt}
    \setlength{\parskip}{6pt plus 2pt minus 1pt}}
}{% if KOMA class
  \KOMAoptions{parskip=half}}
\makeatother
\usepackage{xcolor}
\newif\ifbibliography
\usepackage{longtable,booktabs,array}
\usepackage{calc} % for calculating minipage widths
\usepackage{caption}
% Make caption package work with longtable
\makeatletter
\def\fnum@table{\tablename~\thetable}
\makeatother
\setlength{\emergencystretch}{3em} % prevent overfull lines
\providecommand{\tightlist}{%
  \setlength{\itemsep}{0pt}\setlength{\parskip}{0pt}}
\setcounter{secnumdepth}{-\maxdimen} % remove section numbering
\ifLuaTeX
  \usepackage{selnolig}  % disable illegal ligatures
\fi
\IfFileExists{bookmark.sty}{\usepackage{bookmark}}{\usepackage{hyperref}}
\IfFileExists{xurl.sty}{\usepackage{xurl}}{} % add URL line breaks if available
\urlstyle{same}
\hypersetup{
  pdfauthor={My name},
  hidelinks,
  pdfcreator={LaTeX via pandoc}}

\title{My title}
\author{My name}
\date{}

\begin{document}
\frame{\titlepage}

\section{Section}\label{section}

\begin{frame}{Subsection}
\protect\hypertarget{subsection}{}
\begin{longtable}[]{@{}ll@{}}
\toprule\noalign{}
Col 1 & Col 2 \\
\midrule\noalign{}
\endhead
data & data \\
\bottomrule\noalign{}
\end{longtable}
\end{frame}

\begin{frame}{Subsection}
\protect\hypertarget{subsection-1}{}
Next slide
\end{frame}

\end{document}

After #9022, we get:

% Options for packages loaded elsewhere
\PassOptionsToPackage{unicode}{hyperref}
\PassOptionsToPackage{hyphens}{url}
%
\documentclass[
  ignorenonframetext,
]{beamer}
\usepackage{pgfpages}
\setbeamertemplate{caption}[numbered]
\setbeamertemplate{caption label separator}{: }
\setbeamercolor{caption name}{fg=normal text.fg}
\beamertemplatenavigationsymbolsempty
% Prevent slide breaks in the middle of a paragraph
\widowpenalties 1 10000
\raggedbottom
\setbeamertemplate{part page}{
  \centering
  \begin{beamercolorbox}[sep=16pt,center]{part title}
    \usebeamerfont{part title}\insertpart\par
  \end{beamercolorbox}
}
\setbeamertemplate{section page}{
  \centering
  \begin{beamercolorbox}[sep=12pt,center]{part title}
    \usebeamerfont{section title}\insertsection\par
  \end{beamercolorbox}
}
\setbeamertemplate{subsection page}{
  \centering
  \begin{beamercolorbox}[sep=8pt,center]{part title}
    \usebeamerfont{subsection title}\insertsubsection\par
  \end{beamercolorbox}
}
\AtBeginPart{
  \frame{\partpage}
}
\AtBeginSection{
  \ifbibliography
  \else
    \frame{\sectionpage}
  \fi
}
\AtBeginSubsection{
  \frame{\subsectionpage}
}
\usepackage{amsmath,amssymb}
\usepackage{iftex}
\ifPDFTeX
  \usepackage[T1]{fontenc}
  \usepackage[utf8]{inputenc}
  \usepackage{textcomp} % provide euro and other symbols
\else % if luatex or xetex
  \usepackage{unicode-math} % this also loads fontspec
  \defaultfontfeatures{Scale=MatchLowercase}
  \defaultfontfeatures[\rmfamily]{Ligatures=TeX,Scale=1}
\fi
\usepackage{lmodern}
\ifPDFTeX\else
  % xetex/luatex font selection
\fi
% Use upquote if available, for straight quotes in verbatim environments
\IfFileExists{upquote.sty}{\usepackage{upquote}}{}
\IfFileExists{microtype.sty}{% use microtype if available
  \usepackage[]{microtype}
  \UseMicrotypeSet[protrusion]{basicmath} % disable protrusion for tt fonts
}{}
\makeatletter
\@ifundefined{KOMAClassName}{% if non-KOMA class
  \IfFileExists{parskip.sty}{%
    \usepackage{parskip}
  }{% else
    \setlength{\parindent}{0pt}
    \setlength{\parskip}{6pt plus 2pt minus 1pt}}
}{% if KOMA class
  \KOMAoptions{parskip=half}}
\makeatother
\usepackage{xcolor}
\newif\ifbibliography
\usepackage{longtable,booktabs,array}
\usepackage{calc} % for calculating minipage widths
\usepackage{caption}
% Make caption package work with longtable
\makeatletter
\def\fnum@table{\tablename~\thetable}
\makeatother
\setlength{\emergencystretch}{3em} % prevent overfull lines
\providecommand{\tightlist}{%
  \setlength{\itemsep}{0pt}\setlength{\parskip}{0pt}}
\setcounter{secnumdepth}{-\maxdimen} % remove section numbering
\usepackage{bookmark}
\IfFileExists{xurl.sty}{\usepackage{xurl}}{} % add URL line breaks if available
\urlstyle{same}
\hypersetup{
  pdfauthor={My name},
  hidelinks,
  pdfcreator={LaTeX via pandoc}}

\title{My title}
\author{My name}
\date{}

\begin{document}
\frame{\titlepage}

\section{Section}\label{section}

\begin{frame}{Subsection}
\phantomsection\label{subsection}
\begin{longtable}[]{@{}ll@{}}
\toprule\noalign{}
Col 1 & Col 2 \\
\midrule\noalign{}
\endhead
data & data \\
\bottomrule\noalign{}
\end{longtable}
\end{frame}

\begin{frame}{Subsection}
\phantomsection\label{subsection-1}
Next slide
\end{frame}

\end{document}

The problematic difference is the hypertarget code: \protect\hypertarget{subsection-1}{} changed to \phantomsection\label{subsection}. The small diff with the bookmark package has no effect.

The post-#9022 compilation fails with:

! Undefined control sequence.
\@currentHref ->table.\theHtable

l.122 \end{frame}

The hyperref package doesn't play well with longtable and should be added as a package last I think.

@ccaprani ccaprani added the bug label Jun 25, 2024
@jgm
Copy link
Owner

jgm commented Jun 26, 2024

I just tried this with the latest release:

% pandoc 9914.md -o 9914.pdf -t beamer

It finished with no problem, and the PDF looks correct. What pandoc version are you using? Perhaps you're using a custom template?

@achilleasNP
Copy link

Hi,

I encountered the same problem while using pandoc version 3.2.1 (on Windows). It seems that the conversion from tex to pdf doesn't work with the latest MiKTeX or TeXLive 2024 but works with TeXLive 2022 (at least on Debian).

I tested using the latex file I got from
pandoc 9914.md -o 9914.tex -t beamer -s

I can convert the latex file to pdf using TeXLive 2022 on Debian (texlive-latex-recommended distro package, Bookworm running in WSL) but not with the 2024 TeXLive (Windows or Debian manual install) nor with MiKTeX on Windows.

Thanks for making pandoc available, it's awesome!

@jgm
Copy link
Owner

jgm commented Jul 2, 2024

I'm using texlive 2024 on macOS, and it works there... So I don't think we've really pinned down the issue yet.

Note: beamer loads hyperref automatically, so we don't really have control over the timing of its loading.

@achilleasNP
Copy link

Hi again,

I did a bit more digging and the problem seems to be related to this issue:
longtable v4.20 breaks the ltcaption package #1377
from what I grok from the discussion the same bug affects the caption as well.

Here is what I did to verify:

I first installed TexLive 2024 (texlive2024-20240312.iso which uses LaTeX2e <2023-11-01> patch level 1)
and the example works with that version on Debian (as you said it does in your case under macOS).

I then installed the TexLive 2024 (using the internet install which uses LaTeX2e <2024-06-01> patch level 2) and the conversion fails. Replacing the longtable v4.20 with longtable v4.19 makes the latest version of TexLive to work again for the conversion.

I hope this helps.

@jgm
Copy link
Owner

jgm commented Jul 4, 2024

That's very helpful. Hopefully the underlying issue will be fixed in longtable before long.

@u-fischer
Copy link

That's very helpful. Hopefully the underlying issue will be fixed in longtable before long.

well sorry but without any tex code it is quite impossible to debug such an issue . I can not imagine where the error comes from as longtable doesn't contain table.\theHtable, but table.\cs_if_exist_use:N\theHtable. So if some change correct that it would be only by chance.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

4 participants