I've defined a new command called \mysec
like the below:
\documentclass{article}
\newcommand{\mysec}[1]{\section{#1}}
\begin{document}
\mysec[Foo foo]{Bla bla bla}
\end{document}
But in the PDF output, I get:
1 [
Foo foo]Bla bla bla
How to solve this problem?
By the way, I'd prefer to have the solution without using extra packages. Also note that I don't want to redefine the \section
command.
\newcommand{\mysec}[2][]{\section[#1]{#2}}
?\section
, your\mysec
command will result in incorrect (empty) headers and ToC entries if the optional argument is omitted.