TransWikia.com

Checkmark is not displayed in caption

TeX - LaTeX Asked by phillipe cauchett on November 28, 2020

I tried to display checkmark in a figure caption, but i am getting "undefined control sequence" as error. Note that i can normally display it in a text.

usepackage{amsmath}
usepackage{amsfonts}
usepackage{amssymb}
usepackage{stackrel}
usepackage{bbm} 
usepackage{graphicx}
usepackage{mathrsfs}
usepackage{pifont}
makeatletter
usepackage{tikz}
defcheckmark{tikzfill[scale=0.4](0,.35) -- (.25,0) -- (1,.7) -- (.25,.15) -- cycle;} 
usepackage{graphics}

The part used in the caption:

begin{figure}%[H]
begin{centering}
includegraphics[scale=0.45]{Fig}
parend{centering}
caption{some text checkmark} 
end{figure}

2 Answers

Don't use def, it will not warn you if you overwrite existing commands. Beside this you need to define a robust command as you want to use it in a caption.

documentclass{article}
usepackage{amsmath}
usepackage{amsfonts}
usepackage{amssymb}
usepackage{tikz}
usepackage{xparse} 
RenewDocumentCommandcheckmark{}{tikzfill[scale=0.4](0,.35) -- (.25,0) -- (1,.7) -- (.25,.15) -- cycle;}
begin{document}
begin{figure}%[H]
centering 
figure
caption{some text checkmark}
end{figure}
end{document}

Correct answer by Ulrike Fischer on November 28, 2020

I add another MWE for your question:

documentclass[12pt]{article}
usepackage{amsmath}
usepackage{amssymb}
usepackage{graphicx}

begin{document}
begin{figure}%[H]
centering 
includegraphics[scale=0.4]{example-image-c}
caption{Here there is a checkmark symbol in caption checkmark}
end{figure}
end{document}

enter image description here

Answered by Sebastiano on November 28, 2020

Add your own answers!

Ask a Question

Get help from others!

© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP