Para algunas apariciones de un entorno de "teorema", ¿podemos eliminar los paréntesis, "(" y ")", del argumento opcional del entorno?
Aug 15 2020
Para algunas ocurrencias, ¿podemos eliminar los paréntesis -- (
y )
-- del theorem
argumento opcional de a ?
Estoy listo para usar un comando como \nobracket
, como se muestra a continuación:
\documentclass{article}
\usepackage{amsthm}
\begin{document}
\nobrackets
\begin{theorem}[aaa]
For this theorem don't want bracket ()
\end{theorem}
\begin{theorem}[bbb]
For this theorem need bracket ()
\end{theorem}
\end{document}
Respuestas
Mico Aug 15 2020 at 12:43
En la página 10 de la guía del usuario del amsthm
paquete, se encuentran instrucciones sobre cómo crear un estilo de teorema que comparte la mayoría de las propiedades del plain
estilo de teorema predeterminado, excepto que no se colocan paréntesis alrededor del argumento opcional de un teorema.
La siguiente solución se basa en este material.

\documentclass{article}
\usepackage{amsthm}
\theoremstyle{plain} % the default
\newtheorem{theorem}{Theorem}
\newtheoremstyle{noparens}% cf. p. 10 of user guide of 'amsthm' package
{}{}{\itshape}{}%
{\bfseries}{.}{ }%
{\thmname{#1}\thmnumber{ #2}\thmnote{ {\mdseries #3}}}
\theoremstyle{noparens} % switch to the new theorem style
\newtheorem{theoremnp}[theorem]{Theorem} % 'theoremnp' and 'theorem' share same counter
\begin{document}
\begin{theoremnp}[aaa]
For this theorem we don't want parentheses.
\end{theoremnp}
\begin{theorem}[bbb]
For this theorem we need parentheses.
\end{theorem}
\end{document}
egreg Sep 14 2020 at 16:04
Debe marcar de alguna manera cuando no desea los corchetes.
Con su sintaxis propuesta:
\documentclass{article}
\usepackage{amsthm}
\usepackage{lipsum} % for mock text
\newtheoremstyle{funny}
{}{}
{\itshape}
{}
{\bfseries}
{.}
{ }
{%
\thmname{#1}% the label
\thmnumber{ #2}% the number
\thmnote{ {\mdseries\iffunny(\fi#3\iffunny)\fi}}% the note
\global\funnytrue % restore the standard
}
\newif\iffunny
\newcommand{\nobrackets}{\global\funnyfalse}
\theoremstyle{funny}
\newtheorem{theorem}{Theorem}
\begin{document}
\lipsum[1][1-6]
\nobrackets
\begin{theorem}[aaa]
For this theorem we don't want parentheses.
\end{theorem}
\lipsum[2][1-6]
\begin{theorem}[bbb]
For this theorem we need parentheses.
\end{theorem}
\lipsum[3][1-6]
\end{document}

Con una mejor sintaxis:
\documentclass{article}
\usepackage{amsthm}
\usepackage{lipsum} % for mock text
\newtheoremstyle{funny}
{}{}
{\itshape}
{}
{\bfseries}
{.}
{ }
{%
\thmname{#1}% the label
\thmnumber{ #2}% the number
\thmnote{ {\mdseries\iffunny(\fi#3\iffunny)\fi}}% the note
}
\newif\iffunny
\funnytrue
\theoremstyle{funny}
\newtheorem{theorem}{Theorem}
\newenvironment{theorem*}{\funnyfalse\theorem}{\endtheorem}
\begin{document}
\lipsum[1][1-6]
\begin{theorem*}[aaa]
For this theorem we don't want parentheses.
\end{theorem*}
\lipsum[2][1-6]
\begin{theorem}[bbb]
For this theorem we need parentheses.
\end{theorem}
\lipsum[3][1-6]
\end{document}