\titlecaps 图形标题包含数学表达式

\titlecaps 图形标题包含数学表达式

如果这些标题包含数学表达式,我们该如何使用\titlecaps来获得正确的图形和表格的标题?

根据此网站的建议,我在我的 LaTeX 文件中添加了:

%%% set figure captions to use titlecaps

\DeclareCaptionTextFormat{up}{\titlecap{#1}}

\captionsetup[figure]{textformat=up}

\captionsetup[table]{textformat=up}

但我收到了如下标题的编译错误:

\caption{Simulations performed with k-$\omega$ SST and DDES-SST}

因为k-$\omega$标题中的表达。

----- 版本 2 --------------

感谢您的第一个回答,抱歉没有提供完整的 LaTeX 文档!

这是一个更好的例子,我认为\titlecaps和之间存在冲突\bm

(1)如果对修改相关的行titlecaps进行了注释,则该命令\bm可以正常工作

(2) 如果这些行处于活动状态,则添加时会出现编译错误\bm,如果我没有粗体希腊符号,则一切正常。我希望现在更清楚了。谢谢你的帮助!


 \documentclass[12pt, a4paper]{memoir}

 \usepackage{lipsum}

 \usepackage[bookmarksnumbered, breaklinks=true, colorlinks=true,linkcolor=blue, urlcolor=blue, citecolor=blue,bookmarks=true]{hyperref}

 \usepackage[nameinlink,noabbrev]{cleveref}

 \usepackage{titlecaps}

 \usepackage{caption}

 \usepackage{bm}

%%% CUSTOM STYLE FOR CHAPTER HEADLINES

\makeatletter
\makechapterstyle{article}{%
  \chapterstyle{default}
  \setlength{\beforechapskip}{3.5ex}
  \renewcommand*{\chapterheadstart}{\vspace{\beforechapskip}}
  \setlength{\afterchapskip}{3.3ex}
  \renewcommand{\printchaptername}{} % removes word chapter from chapter number
  \renewcommand{\chapnumfont}{\normalfont\bfseries\Large}
  \renewcommand\printchaptertitle[1]{\normalfont\bfseries\Large\titlecap{##1}} % title caps for chapter headings
  \renewcommand{\afterchapternum}{}
  \renewcommand*{\printchapternum}{%
    \@hangfrom{\chapnumfont \thechapter\quad}}%
}
\makeatother

\chapterstyle{article}

%%% STYLE OF SECTIONS, SUBSECTIONS, AND SUB-SUBSECTIONS
 
 \maxsecnumdepth{subsection} % chapters, sections, subsections numbered

% set section headings to titlecaps
\newcommand\sectioncaps[1]{%
  \bfseries\raggedright\titlecap{#1}%
}
% set subsection headings to titlecaps
\newcommand\subsectioncaps[1]{%
  \bfseries\raggedright\titlecap{#1}%
}
\setsecheadstyle{\sectioncaps}
\setsubsecheadstyle{\subsectioncaps}

%%% set figure captions to use titlecaps

\DeclareCaptionTextFormat{up}{\titlecap{#1}}
\captionsetup[figure]{textformat=up}

\settypeblocksize{237mm}{150mm}{*} % size of text block on page
\setulmargins{3.5cm}{*}{*} % sets start of text on page after ruled header
\setheadfoot{\onelineskip}{2\onelineskip}
\setheaderspaces{2cm}{*}{*} % start of rule header line on page
\setlrmarginsandblock{3.5cm}{2.5cm}{*} % left and right margins
\checkandfixthelayout

\begin{document}

\chapter{This is a nice chapter title it should be titlecaps}

\section{A first section title and should also be titlecaps}

\subsection{A subsection title, also in titlecaps}
\lipsum[3]

\begin{figure}[htb]

    \centering

%    \caption{This is a text for a caption and should be title caps with $\bm{\omega}$} % is not working

    \caption{This is a text for a caption and should be title caps with $\omega$} % is OK

    \label{fig:my_label}

\end{figure}

\end{document}

相关内容