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

Caption font reset #720

Open
senthilmm opened this issue Sep 30, 2024 · 7 comments
Open

Caption font reset #720

senthilmm opened this issue Sep 30, 2024 · 7 comments
Labels
area: floats and captions currently incompatible package or class package or class that doesn't work with current version of tagging code duplicate This issue or pull request already exists workaround provided

Comments

@senthilmm
Copy link

Testphase=phase-III

Caption label and text font is reset to serif.

MWE-CaptionTest.zip

Testphase=phase-II gives the correct output.

Thanks
Senthil

@u-fischer
Copy link
Member

Sorry, but the caption package is currently not supported. See e.g. #84 and also the status list https://latex3.github.io/tagging-project/tagging-status/

@senthilmm
Copy link
Author

Thanks. Much appreciated.

@FrankMittelbach FrankMittelbach added area: floats and captions duplicate This issue or pull request already exists currently incompatible package or class package or class that doesn't work with current version of tagging code labels Sep 30, 2024
@u-fischer
Copy link
Member

You could try the following. It is not perfect (e.g. the label is not tagged as Lbl) and not much tested, so can perhaps break somewhere (e.g. better do not use \parbox inside a caption ...), but for normal captions it seems to work. Feedback about problems is welcome!

\DocumentMetadata
{
    testphase={phase-III},
    pdfstandard = a-4,
    pdfversion  = 2.0,
    lang        = en,
}

\documentclass[11pt]{article}

\usepackage{caption}

\RemoveFromHook{begindocument}[latex-lab-testphase-float]
\makeatletter
\ExplSyntaxOn
\socket_new_plug:nnn{tagsupport/parbox/before}{caption}
  {   
   \tagpdfparaOn %restart para tagging
   \tl_if_empty:NTF\@current@float@struct
    {     
     \tag_struct_begin:n{tag=Caption,firstkid}
    }
    {
     \tag_struct_begin:n{tag=Caption,parent=\@current@float@struct,firstkid}
    } 
  }
\socket_new_plug:nnn{tagsupport/parbox/after}{caption}
  {
   \tag_struct_end:   
  }
\l@addto@macro\caption@beginex@hook{%
  \tagpdfparaOff %leavevmode in parbox should not start paragraph structure
  \AssignSocketPlug{tagsupport/parbox/before}{caption}
  \AssignSocketPlug{tagsupport/parbox/after}{caption}}
\ExplSyntaxOff
\makeatother
\usepackage{hyperref} 

\captionsetup{labelfont=bf,textfont=it,format=hang}
 \captionsetup[figure]{name={Fig.}}
\captionsetup[table]{name={Table}}
\begin{document}

\section{section}

\begin{minipage}{4cm}
some table
\captionof{table}{a table}
\end{minipage}

\begin{figure}

some figure

\caption{a longer text over than on line and even more longer
longer longer longer longer}\label{test}

more text
\end{figure}

\ref{test}
\end{document} 

@John02139
Copy link

This patch resolves the caption font issue in my test files.

However, the interaction with list of figures still occurs, leading to warnings:

Package tagpdf Warning: Destination 'figure.caption.11' has no related
(tagpdf)                structure.
(tagpdf)                /Ref not updated.

@senthilmm
Copy link
Author

This patch does resolve the font issue of the caption for float. Thanks.

@u-fischer
Copy link
Member

@John02139 try with this addition:

\renewcommand*\caption@anchor[1]{%
      \ifmeasuring@ \else
        \caption@raisedlink{\MakeLinkTarget*{#1}}%
      \fi}%  

@John02139
Copy link

If I do this in my cls file, the tagging warning is cured:

\AtBeginDocument{
	\renewcommand*\caption@anchor[1]{%
        \ifmeasuring@ \else
           \caption@raisedlink{\MakeLinkTarget*{#1}}%
        \fi}%  
}

(I guess I am uncertain of the correct loading order.)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area: floats and captions currently incompatible package or class package or class that doesn't work with current version of tagging code duplicate This issue or pull request already exists workaround provided
Projects
None yet
Development

No branches or pull requests

4 participants