最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

latex - TexLive and MikTex produce different references using cref - Stack Overflow

programmeradmin1浏览0评论

Problem description

I use Texlive 2024 in a docker-image to build my PDF in a github action. On my laptop I use TexStudio with MikTex to build my PDF. TexLive and MikTex produce different outputs for the references when using \cref{}. I want to figure out why and how I can solve the issue.

I can reproduce the TexLive issue on my laptop, using the docker: FROM texlive/texlive:latest

In both cases I'm using lualatex for building the PDF. I get the same results with pdflatex or xelatex.

Used versions:

  • used version of longtable:
    • texLive: v4.20 from 2024-4-26
    • MikTex: the longtable package does not appear in the list of installed packages ;-(
  • used version cleverref:
    • texlive: v021.4 from 2018-4-22
    • miktex: v021.4 from 2018-4-22

What I already tried

  • use pdflatex and xelatex. They produce the same output.
  • I tried different table environments:
    • tabalar inside a \begin{table} ... \end{table} does not have the same issue.
    • collected keyvaltable has the same issue
    • I placed the longtable into a \begin{table} ... \end{table}, this did not help.
  • I placed the caption and label at the end of the longtable
  • I placed the label inside the caption: \caption{Cherries \label{tab:recipe}}

My question

I can use some hints of how to figure out what is going on. Does anyone have an idea?

MWE

\documentclass{report}

\usepackage{longtable}
\RequirePackage{cleveref}

\begin{document}
    \chapter{Table referencing problem}\label{ch:this_chapter}
    When using cleverref, we get this reference to the table: \textbf{\cref{tab:recipe}}. 

    When using a good-old ref: \textbf{table~\ref{tab:recipe}}. 

    This should show "\textbf{table 1.1}" both times.    
    
    \let\tableHeader\outer\renewcommand{\tableHeader}{\textbf{amount} & \textbf{ingeredient} & \textbf{step}\\}
    \let\numcols\outer\renewcommand{\numcols}{3}
    \begin{center}
        \begin{longtable}{c c c}
            \caption{Cherries} \label{tab:recipe}\\
            \tableHeader
            \endfirsthead
    
            \multicolumn{\numcols}{c}{{\textbf{\tablename\ \thetable{}:} \textit{\ldots continued from previous page}}} \\
            \tableHeader
            \endhead
        
            \multicolumn{\numcols}{r}{{\textit{\ldots continued on next page}}}
            \endfoot
        
            \endlastfoot
    
            150g & Ice cream & put into bowl \\
            50g  & cherries & heat up and add to bowl
            \end{longtable}
    \end{center}
\end{document}

TexLive output

MikTex output

发布评论

评论列表(0)

  1. 暂无评论