I try to write absolute value symbols and norm symbols in section. The command \norm* and \abs* in package physics works not well. So I use the solution in Absolute Value Symbols. But when I put this command in section:
\documentclass{article}
\usepackage{mathtools}
\DeclarePairedDelimiter\abs{\lvert}{\rvert}%
\DeclarePairedDelimiter\norm{\lVert}{\rVert}%
\makeatletter
\let\oldabs\abs
\def\abs{@ifstar{\oldabs}{\oldabs}}
%
\let\oldnorm\norm
\def\norm{@ifstar{\oldnorm}{\oldnorm}}
\makeatother
\begin{document}
\section{$\norm{T}$}
\end{document}
it report error:
Argument of \@sect has an extra }.
<inserted text>
Paragraph ended before @sect was complete.
<to be read again>
If there any method to modify the solution in Absolute Value Symbols such that I can use command \norm, \abs in section title?
\makeatletterto\makeatother. You don't want to type$\norm{T}+\norm{\hat{T}}$and get this output (click) – egreg Sep 09 '22 at 09:09\abs*or\norm*when you need automatic sizing, but bear in mind that such method may produce humongous delimiters like in the example I showed. – egreg Sep 09 '22 at 13:50\absand\abs*? I use physics package before, so I write a lot of Tex codes using\absfor automatic sizing. – sakurajyan Sep 10 '22 at 02:11