![在章节标题中使用通过 \@ifstar 定义的宏时出现 Titlesec 错误](https://linux22.com/image/462403/%E5%9C%A8%E7%AB%A0%E8%8A%82%E6%A0%87%E9%A2%98%E4%B8%AD%E4%BD%BF%E7%94%A8%E9%80%9A%E8%BF%87%20%5C%40ifstar%20%E5%AE%9A%E4%B9%89%E7%9A%84%E5%AE%8F%E6%97%B6%E5%87%BA%E7%8E%B0%20Titlesec%20%E9%94%99%E8%AF%AF.png)
我正在使用titlesec
并且想要使用在段落标题中带有星号变体的宏:
\documentclass{article}
\RequirePackage{titlesec}
\makeatletter
\def\something{\@ifstar{A}{B}}
\makeatother
\begin{document}
\paragraph{A \something\ title} Lipsum.
\end{document}
然而这会返回错误
mwe.tex:9: Argument of \ttl@assign@i has an extra }. [\paragraph{A \something\ title}]
mwe.tex:9: Paragraph ended before \ttl@assign@i was complete. [\paragraph{A \something\ title}]
为什么会发生这种情况?我该如何解决?