3

How do I get sans serif fonts for captions containing math characters in lists?

Here is a mwe where the x^2 from mathmode in the list of figures is represented with serifs instead of the wanted sans serif font:

\documentclass[]{article}   
\usepackage{tocloft}

\renewcommand\cftfigfont{\sffamily}
\renewcommand\cftfigpagefont{\sffamily}

\begin{document}

\listoffigures

\begin{figure}[!ht]\centering Figure\caption{test x\textsuperscript{2}}\end{figure}
\begin{figure}[!ht]\centering Figure\caption{test $x^2$}\end{figure}

\end{document}
3

You can work with the package sansmath which provides two commands \sansmath and unsansmath:

\documentclass[]{article}   
\usepackage{tocloft}
\usepackage{sansmath}
\renewcommand\cftfigfont{\sffamily}
\renewcommand\cftfigpagefont{\sffamily}

\begin{document}

\sansmath
\listoffigures
\unsansmath

\begin{figure}[!ht]\centering Figure\caption{test x\textsuperscript{2}}\end{figure}
\begin{figure}[!ht]\centering Figure\caption{test $x+x^2$}\end{figure}

\end{document}

enter image description here

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.