In the past, when I added an external image inside a Tikz picture using includegraphics
, I could add a caption to this image by using the captionof
command from the caption
package. However, after upgrading my Fedora system, I get an error (see details below).
Example document that used to work fine (add your own PNG image if you want to give it a try):
\documentclass{article}
\usepackage{caption}
\usepackage{tikz}
\begin{document}
\begin{tikzpicture}[remember picture, overlay]
\node[inner sep=0] at (current page.center){
\includegraphics[width=100mm]{test.png}
\captionof{figure}{Caption}
};
\end{tikzpicture}
\end{document}
Error produced after updating to Fedora 38:
! You can't use `\hrule' here except with leaders.
\caption@hrule ->\hrule
\@height \z@
l.12 \captionof{figure}{Caption}
?
! Emergency stop.
\caption@hrule ->\hrule
\@height \z@
l.12 \captionof{figure}{Caption}
801 words of node memory still in use:
10 hlist, 4 rule, 6 dir, 5 glue, 4 kern, 1 glyph, 20 attribute, 77 glue_spec
, 20 attribute_list, 5 temp, 2 write, 5 pdf_literal, 3 pdf_colorstack, 1 pdf_se
tmatrix, 1 pdf_save, 1 pdf_restore nodes
avail lists: 2:7
! ==> Fatal error occurred, no output PDF file produced!
Transcript written on test.log.
Does anybody have an idea on how to solve this?
For completeness, find below a list of versions of all Texlive packages installed on my system:
texlive-texlive-common-doc-svn54176-65.fc38.noarch
texlive-base-20220321-72.fc38.x86_64
texlive-lib-20220321-72.fc38.x86_64
texlive-epstopdf-svn64439-72.fc38.noarch
texlive-epstopdf-pkg-svn53546-65.fc38.noarch
texlive-cm-svn57963-65.fc38.noarch
texlive-etex-svn56291-65.fc38.noarch
texlive-graphics-def-svn64487-65.fc38.noarch
texlive-hyph-utf8-svn61719-65.fc38.noarch
texlive-hyphen-base-svn62751-65.fc38.noarch
texlive-knuth-lib-svn57963-65.fc38.noarch
texlive-plain-svn57963-65.fc38.noarch
texlive-tex-ini-files-svn40533-65.fc38.noarch
texlive-unicode-data-svn64423-65.fc38.noarch
texlive-gsftopk-svn52851-72.fc38.x86_64
texlive-luatex-svn64839-72.fc38.x86_64
texlive-texlive.infra-svn63645-72.fc38.noarch
texlive-texlive-scripts-svn64830-72.fc38.noarch
texlive-kpathsea-svn64475-72.fc38.x86_64
texlive-iftex-svn61910-65.fc38.noarch
texlive-amsmath-svn63514-65.fc38.noarch
texlive-pdftexcmds-svn55777-65.fc38.noarch
texlive-kvoptions-svn63622-65.fc38.noarch
texlive-amsfonts-svn61937-65.fc38.noarch
texlive-atbegshi-svn53051-65.fc38.noarch
texlive-booktabs-svn53402-65.fc38.noarch
texlive-etex-pkg-svn41784-65.fc38.noarch
texlive-etoolbox-svn56554-65.fc38.noarch
texlive-ltxcmds-svn56421-65.fc38.noarch
texlive-url-svn32528.3.4-65.fc38.noarch
texlive-babel-svn65366-65.fc38.noarch
texlive-fp-svn49719-65.fc38.noarch
texlive-infwarerr-svn53023-65.fc38.noarch
texlive-hypdoc-svn63808-65.fc38.noarch
texlive-atveryend-svn53108-65.fc38.noarch
texlive-auxhook-svn53173-65.fc38.noarch
texlive-etexcmds-svn53171-65.fc38.noarch
texlive-latex-fonts-svn28888.0-65.fc38.noarch
texlive-lm-svn61719-65.fc38.noarch
texlive-multido-svn18302.1.42-65.fc38.noarch
texlive-natbib-svn20668.8.31b-65.fc38.noarch
texlive-pdfescape-svn53082-65.fc38.noarch
texlive-catchfile-svn53084-65.fc38.noarch
texlive-ifplatform-svn45533-65.fc38.noarch
texlive-atenddvi-svn56922-65.fc38.noarch
texlive-bigintcalc-svn53172-65.fc38.noarch
texlive-float-svn15878.1.3d-65.fc38.noarch
texlive-footmisc-svn62524-65.fc38.noarch
texlive-graphics-cfg-svn41448-65.fc38.noarch
texlive-graphics-svn64892-65.fc38.noarch
texlive-tools-svn64892-65.fc38.noarch
texlive-xkeyval-svn63616-65.fc38.noarch
texlive-geometry-svn61719-65.fc38.noarch
texlive-caption-svn62757-65.fc38.noarch
texlive-subfig-svn15878.1.3-65.fc38.noarch
texlive-colortbl-svn64015-65.fc38.noarch
texlive-csquotes-svn64389-65.fc38.noarch
texlive-translator-svn59412-65.fc38.noarch
texlive-hologo-svn61719-65.fc38.noarch
texlive-hycolor-svn53584-65.fc38.noarch
texlive-intcalc-svn53168-65.fc38.noarch
texlive-kvsetkeys-svn64632-65.fc38.noarch
texlive-letltxmacro-svn53022-65.fc38.noarch
texlive-marvosym-svn29349.2.2a-65.fc38.noarch
texlive-palatino-svn61719-65.fc38.noarch
texlive-ragged2e-svn65008-65.fc38.noarch
texlive-setspace-svn65206-65.fc38.noarch
texlive-textcase-svn63868-65.fc38.noarch
texlive-uniquecounter-svn53162-65.fc38.noarch
texlive-varwidth-svn24104.0.92-65.fc38.noarch
texlive-zapfding-svn61719-65.fc38.noarch
texlive-zref-svn62977-65.fc38.noarch
texlive-rerunfilecheck-svn63869-65.fc38.noarch
texlive-carlisle-svn59577-65.fc38.noarch
texlive-microtype-svn63708-65.fc38.noarch
texlive-sauerj-svn15878.0-65.fc38.noarch
texlive-bitset-svn53837-65.fc38.noarch
texlive-dvips-svn62387-72.fc38.x86_64
texlive-babelbib-svn57349-65.fc38.noarch
texlive-mfirstuc-svn64743-65.fc38.noarch
texlive-memoir-svn65040-65.fc38.noarch
texlive-glyphlist-svn54074-72.fc38.noarch
texlive-avantgar-svn61983-65.fc38.noarch
texlive-bookman-svn61719-65.fc38.noarch
texlive-bookmark-svn56885-65.fc38.noarch
texlive-charter-svn15878.0-65.fc38.noarch
texlive-courier-svn61719-65.fc38.noarch
texlive-ec-svn25033.1.0-65.fc38.noarch
texlive-enumitem-svn51423-65.fc38.noarch
texlive-euenc-svn19795.0.1h-65.fc38.noarch
texlive-euler-svn42428-65.fc38.noarch
texlive-everyshi-svn57001-65.fc38.noarch
texlive-fancybox-svn18304.1.4-65.fc38.noarch
texlive-fancyhdr-svn64977-65.fc38.noarch
texlive-fontaxes-svn55920-65.fc38.noarch
texlive-fpl-svn54512-65.fc38.noarch
texlive-mathpazo-svn52663-65.fc38.noarch
texlive-gettitlestring-svn53170-65.fc38.noarch
texlive-grfext-svn53024-65.fc38.noarch
texlive-grffile-svn52756-65.fc38.noarch
texlive-helvetic-svn61719-65.fc38.noarch
texlive-index-svn24099.4.1beta-65.fc38.noarch
texlive-kvdefinekeys-svn53193-65.fc38.noarch
texlive-l3backend-svn64836-65.fc38.noarch
texlive-latexconfig-svn53525-65.fc38.noarch
texlive-lm-math-svn36915.1.959-65.fc38.noarch
texlive-lua-alt-getopt-svn56414-65.fc38.noarch
texlive-modes-svn61719-65.fc38.noarch
texlive-mweights-svn53520-65.fc38.noarch
texlive-newfloat-svn52906-65.fc38.noarch
texlive-paralist-svn43021-65.fc38.noarch
texlive-pdflscape-svn64851-65.fc38.noarch
texlive-placeins-svn19848.2.2-65.fc38.noarch
texlive-refcount-svn53164-65.fc38.noarch
texlive-rsfs-svn15878.0-65.fc38.noarch
texlive-stringenc-svn52982-65.fc38.noarch
texlive-symbol-svn61719-65.fc38.noarch
texlive-times-svn61719-65.fc38.noarch
texlive-transparent-svn64852-65.fc38.noarch
texlive-txfonts-svn15878.0-65.fc38.noarch
texlive-ucharcat-svn38907-65.fc38.noarch
texlive-underscore-svn18261.0-65.fc38.noarch
texlive-utopia-svn15878.0-65.fc38.noarch
texlive-psnfss-svn54694-65.fc38.noarch
texlive-wasy-svn53533-65.fc38.noarch
texlive-xfor-svn15878.1.05-65.fc38.noarch
texlive-xstring-svn60007-65.fc38.noarch
texlive-wasy-type1-svn53534-65.fc38.noarch
texlive-metafont-svn62387-72.fc38.x86_64
texlive-auto-pst-pdf-svn56596-65.fc38.noarch
texlive-breakurl-svn29901.1.40-65.fc38.noarch
texlive-fancyref-svn15878.0.9c-65.fc38.noarch
texlive-ltabptch-svn17533.1.74d-65.fc38.noarch
texlive-mathtools-svn63767-65.fc38.noarch
texlive-crop-svn55424-65.fc38.noarch
texlive-logreq-svn53003-65.fc38.noarch
texlive-bigfoot-svn38248.2.1-65.fc38.noarch
texlive-ncctools-svn51810-65.fc38.noarch
texlive-pdfmanagement-testphase-svn64931-65.fc38.noarch
texlive-psfrag-svn15878.3.04-65.fc38.noarch
texlive-euro-svn22191.1.1-65.fc38.noarch
texlive-hopatch-svn56106-65.fc38.noarch
texlive-elocalloc-svn42712-65.fc38.noarch
texlive-tex-gyre-svn48058-65.fc38.noarch
texlive-filemod-svn64967-65.fc38.noarch
texlive-latex-lab-svn64892-65.fc38.noarch
texlive-lua-uni-algos-svn62204-65.fc38.noarch
texlive-pdfcol-svn64469-65.fc38.noarch
texlive-bibtex-svn64491-72.fc38.x86_64
texlive-luahbtex-svn62387-72.fc38.x86_64
texlive-lwarp-svn63905-72.fc38.noarch
texlive-makeindex-svn62517-72.fc38.x86_64
texlive-mfware-svn62387-72.fc38.x86_64
texlive-mptopdf-svn61520-72.fc38.noarch
texlive-splitindex-svn39766-72.fc38.noarch
texlive-tex-svn62387-72.fc38.x86_64
texlive-texlive-en-svn64221-72.fc38.noarch
texlive-xdvi-svn62387-72.fc38.x86_64
texlive-accsupp-svn53052-65.fc38.noarch
texlive-alphalph-svn53087-65.fc38.noarch
texlive-anysize-svn15878.0-65.fc38.noarch
texlive-babel-english-svn44495-65.fc38.noarch
texlive-beton-svn15878.0-65.fc38.noarch
texlive-changepage-svn15878.1.0c-65.fc38.noarch
texlive-cite-svn36428.5.5-65.fc38.noarch
texlive-cmap-svn57640-65.fc38.noarch
texlive-cmextra-svn57866-65.fc38.noarch
texlive-collectbox-svn64967-65.fc38.noarch
texlive-colorprofiles-svn49086-65.fc38.noarch
texlive-ctablestack-svn38514-65.fc38.noarch
texlive-luatexbase-svn52663-65.fc38.noarch
texlive-dehyph-svn48599-65.fc38.noarch
texlive-pdftex-svn64690-72.fc38.x86_64
texlive-enctex-svn34957.0-65.fc38.noarch
texlive-euro-ce-svn25714-65.fc38.noarch
texlive-eurosym-svn17265.1.4_subrfix-65.fc38.noarch
texlive-everysel-svn57489-65.fc38.noarch
texlive-filecontents-svn52142-65.fc38.noarch
texlive-finstrut-svn21719.0.5-65.fc38.noarch
texlive-lineno-svn65204-65.fc38.noarch
texlive-firstaid-svn64892-65.fc38.noarch
texlive-fix2col-svn38770-65.fc38.noarch
texlive-footnotehyper-svn60374-65.fc38.noarch
texlive-framed-svn26789.0.96-65.fc38.noarch
texlive-hobsub-svn52810-65.fc38.noarch
texlive-hyperref-svn65014-65.fc38.noarch
texlive-attachfile2-svn57959-72.fc38.noarch
texlive-attachfile-svn42099-65.fc38.noarch
texlive-hyphenex-svn57387-65.fc38.noarch
texlive-ifmtarg-svn47544-65.fc38.noarch
texlive-ifoddpage-svn64967-65.fc38.noarch
texlive-import-svn54683-65.fc38.noarch
texlive-kastrup-svn15878.0-65.fc38.noarch
texlive-knuth-local-svn57963-65.fc38.noarch
texlive-latexbug-svn63596-65.fc38.noarch
texlive-lipsum-svn60561-65.fc38.noarch
texlive-listofitems-svn51923-65.fc38.noarch
texlive-luabidi-svn54512-65.fc38.noarch
texlive-lualibs-svn64615-65.fc38.noarch
texlive-luaotfload-svn64616-72.fc38.noarch
texlive-makecmds-svn15878.0-65.fc38.noarch
texlive-manfnt-font-svn45777-65.fc38.noarch
texlive-marginnote-svn48383-65.fc38.noarch
texlive-mdwtools-svn15878.1.05.4-65.fc38.noarch
texlive-mflogo-font-svn54512-65.fc38.noarch
texlive-mflogo-svn42428-65.fc38.noarch
texlive-mfnfss-svn46036-65.fc38.noarch
texlive-mparhack-svn59066-65.fc38.noarch
texlive-ncntrsbk-svn61719-65.fc38.noarch
texlive-needspace-svn29601.1.3d-65.fc38.noarch
texlive-notoccite-svn18129.0-65.fc38.noarch
texlive-ntgclass-svn56959-65.fc38.noarch
texlive-pagesel-svn56105-65.fc38.noarch
texlive-parallel-svn15878.0-65.fc38.noarch
texlive-parskip-svn58358-65.fc38.noarch
texlive-pdfcolmk-svn52912-65.fc38.noarch
texlive-xcolor-svn63563-65.fc38.noarch
texlive-eso-pic-svn56658-65.fc38.noarch
texlive-ctable-svn38672-65.fc38.noarch
texlive-picture-svn54867-65.fc38.noarch
texlive-pslatex-svn57434-65.fc38.noarch
texlive-pspicture-svn15878.0-65.fc38.noarch
texlive-pst-math-svn64732-65.fc38.noarch
texlive-pxfonts-svn15878.0-65.fc38.noarch
texlive-rcs-svn15878.0-65.fc38.noarch
texlive-sansmath-svn17997.1.1-65.fc38.noarch
texlive-section-svn20180.0-65.fc38.noarch
texlive-selinput-svn53098-65.fc38.noarch
texlive-sepnum-svn20186.2.0-65.fc38.noarch
texlive-substr-svn16117.1.2-65.fc38.noarch
texlive-supertabular-svn53658-65.fc38.noarch
texlive-svn-prov-svn64967-65.fc38.noarch
texlive-tex-gyre-math-svn41264-65.fc38.noarch
texlive-texlive-msg-translations-svn63700-65.fc38.noarch
texlive-titlesec-svn59845-65.fc38.noarch
texlive-algorithms-svn42428-65.fc38.noarch
texlive-bera-svn20031.0-65.fc38.noarch
texlive-cm-super-svn15878.0-65.fc38.noarch
texlive-xunicode-svn30466.0.981-65.fc38.noarch
texlive-tipa-svn29349.1.3-65.fc38.noarch
texlive-fontspec-svn63386-65.fc38.noarch
texlive-l3packages-svn65300-65.fc38.noarch
texlive-xpatch-svn54563-65.fc38.noarch
texlive-l3kernel-svn65299-65.fc38.noarch
texlive-latex-svn63825-72.fc38.noarch
texlive-xifthen-svn38929-65.fc38.noarch
texlive-currfile-svn64673-65.fc38.noarch
texlive-filehook-svn64822-65.fc38.noarch
texlive-pgf-svn59210-65.fc38.noarch
texlive-ms-svn57473-65.fc38.noarch
texlive-koma-script-svn64685-65.fc38.noarch
texlive-showexpl-svn57414-65.fc38.noarch
texlive-bidi-svn64967-65.fc38.noarch
texlive-polyglossia-svn65144-65.fc38.noarch
texlive-biblatex-svn63878-65.fc38.noarch
texlive-listings-svn55265-65.fc38.noarch
texlive-fancyvrb-svn63496-65.fc38.noarch
texlive-pst-3d-svn17257.1.10-65.fc38.noarch
texlive-pst-coil-svn62977-65.fc38.noarch
texlive-pst-eps-svn15878.1.0-65.fc38.noarch
texlive-pst-fill-svn60671-65.fc38.noarch
texlive-pst-grad-svn15878.1.06-65.fc38.noarch
texlive-pst-node-svn61838-65.fc38.noarch
texlive-pst-ovl-svn54963-65.fc38.noarch
texlive-pst-plot-svn65346-65.fc38.noarch
texlive-pst-text-svn49542-65.fc38.noarch
texlive-pst-tools-svn60621-65.fc38.noarch
texlive-pst-tree-svn60421-65.fc38.noarch
texlive-pstricks-add-svn65067-65.fc38.noarch
texlive-pstricks-svn65346-65.fc38.noarch
texlive-amscls-svn55378-65.fc38.noarch
texlive-adjustbox-svn64967-65.fc38.noarch
texlive-upquote-svn26059.v1.3-65.fc38.noarch
texlive-metalogo-svn18611.0.12-65.fc38.noarch
texlive-fvextra-svn65158-65.fc38.noarch
texlive-gincltex-svn64967-65.fc38.noarch
texlive-pst-blur-svn15878.2.0-65.fc38.noarch
texlive-seminar-svn59801-65.fc38.noarch
texlive-datatool-svn52663-65.fc38.noarch
texlive-media9-svn64047-65.fc38.noarch
texlive-ocgx2-svn65292-65.fc38.noarch
texlive-pgfopts-svn56615-65.fc38.noarch
texlive-lualatex-math-svn61464-65.fc38.noarch
texlive-unicode-math-svn61719-65.fc38.noarch
texlive-oberdiek-svn64463-72.fc38.noarch
texlive-pdfpages-svn65319-65.fc38.noarch
texlive-sansmathaccent-svn53628-65.fc38.noarch
texlive-ae-svn15878.1.4-65.fc38.noarch
texlive-extsizes-svn17263.1.4a-65.fc38.noarch
texlive-jknapltx-svn19440.0-65.fc38.noarch
texlive-ly1-svn63565-65.fc38.noarch
texlive-minitoc-svn61719-65.fc38.noarch
texlive-ltxmisc-svn21927.0-65.fc38.noarch
texlive-mnsymbol-svn18651.1.4-65.fc38.noarch
texlive-mathspec-svn42773-65.fc38.noarch
texlive-ntheorem-svn27609.1.33-65.fc38.noarch
texlive-typehtml-svn17134.0-65.fc38.noarch
texlive-ucs-svn64114-65.fc38.noarch
texlive-beamer-svn64388-65.fc38.noarch
texlive-breqn-svn60881-65.fc38.noarch
texlive-kantlipsum-svn51727-65.fc38.noarch
texlive-l3experimental-svn63089-65.fc38.noarch
texlive-realscripts-svn56594-65.fc38.noarch
texlive-xltxtra-svn56594-65.fc38.noarch
texlive-tracklang-svn65263-65.fc38.noarch
texlive-trimspaces-svn15878.1.1-65.fc38.noarch
texlive-environ-svn56615-65.fc38.noarch
texlive-wasysym-svn54080-65.fc38.noarch
texlive-xetexconfig-svn45845-65.fc38.noarch
texlive-dvipdfmx-svn61101-72.fc38.x86_64
texlive-xetex-svn62387-72.fc38.x86_64
texlive-collection-basic-svn59159-65.fc38.noarch
texlive-collection-latex-svn63515-65.fc38.noarch
texlive-zapfchan-svn61719-65.fc38.noarch
texlive-thumbpdf-svn62518-72.fc38.noarch
texlive-collection-latexrecommended-svn63547-65.fc38.noarch
texlive-xindy-svn59894-72.fc38.x86_64
texlive-collection-fontsrecommended-svn54074-65.fc38.noarch
texlive-forest-svn57398-65.fc38.noarch
texlive-tcolorbox-svn63713-65.fc38.noarch
texlive-glossaries-svn64919-72.fc38.noarch
texlive-mdframed-svn31075.1.9b-65.fc38.noarch
texlive-mathdesign-svn31639.2.31-65.fc38.noarch
texlive-animate-svn64401-65.fc38.noarch
texlive-bclogo-svn39364-65.fc38.noarch
texlive-standalone-svn64677-65.fc38.noarch
texlive-minted-svn65252-65.fc38.noarch
texlive-nicematrix-svn65253-65.fc38.noarch
texlive-todonotes-svn59465-65.fc38.noarch
texlive-cprotect-svn21209.1.0e-65.fc38.noarch
texlive-fmtcount-svn53912-65.fc38.noarch
texlive-inconsolata-svn54512-65.fc38.noarch
texlive-roboto-svn64350-65.fc38.noarch
texlive-xcharter-svn63057-65.fc38.noarch
texlive-imakeidx-svn42287-65.fc38.noarch
texlive-svg-svn57010-65.fc38.noarch
texlive-stackengine-svn60019-65.fc38.noarch
texlive-elsarticle-svn56999-65.fc38.noarch
texlive-textpos-svn63967-65.fc38.noarch
texlive-etoc-svn65068-65.fc38.noarch
texlive-makecell-svn15878.0.1e-65.fc38.noarch
texlive-qstest-svn15878.0-65.fc38.noarch
texlive-latexindent-svn63581-72.fc38.noarch
texlive-texdoc-svn62815-72.fc38.noarch
texlive-babel-dutch-svn60362-65.fc38.noarch
texlive-datetime2-dutch-svn47355-65.fc38.noarch
texlive-fontawesome5-svn63207-65.fc38.noarch
texlive-fontsize-svn60161-65.fc38.noarch
texlive-globalvals-svn49962-65.fc38.noarch
texlive-hyphen-dutch-svn58609-65.fc38.noarch
texlive-hyphenat-svn15878.2.3c-65.fc38.noarch
texlive-inlinedef-svn15878.1.0-65.fc38.noarch
texlive-lastpage-svn60414-65.fc38.noarch
texlive-layouts-svn42428-65.fc38.noarch
texlive-listingsutf8-svn53097-65.fc38.noarch
texlive-noto-svn64351-65.fc38.noarch
texlive-soul-svn56495-65.fc38.noarch
texlive-booktabs-doc-svn53402-65.fc38.noarch
texlive-capt-of-svn29803.0-65.fc38.noarch
The \captionof
needs to be in something with a fixed width. You can avoid the problem by e.g. placing a parbox around it:
\documentclass{article}
\usepackage{caption}
\usepackage{tikz}
\begin{document}
\begin{tikzpicture}[remember picture, overlay]
\node[inner sep=0,text width=100mm] at (current page.center){
\includegraphics[width=100mm]{example-image-duck}
\parbox{100mm}{\captionof{figure}{Caption}}
};
\end{tikzpicture}
\end{document}