6

I'm writing a little text, but for some reason it won't compile when I do:

\begin{prop}[Existência de $\sqrt[n]{a}$, $a > 0$, $n \in \mathbb{Z}_{>0}$]
Sejam $a >0$ e $n \in \mathbb{Z}_{>0}$. Existe $b \in \R_{>0}$ tal que $b^n = a$.
\end{prop}

because of the \sqrt[n]{a}. I'm pretty positive that this is the problem, because when I take it off it all compiles normally. I don't know what it wants me to do to fix this. The warnings are:

Argument of \@sqrt has an extra } \begin{prop}[Existência de $\sqrt[n],

Paragraph ended before \@sqrt was complete \begin{prop}[Existência de $\sqrt[n]

Something's wrong--perhaps a missing \item. \end{prop}

Missing } inserted \end{prop}

They don't make any sense. How to fix?


In case it is needed, the piece of code before:

A ideia para verificarmos as desigualdades acima se resumiu a eliminar os termos positivos, e usar que: \[n > 1 \implies n^m > n \implies \frac{1}{n^m} < \frac{1}{n} \implies -\frac{1}{n^m} > -\frac{1}{n},\quad \forall\,m \in \mathbb{Z}_{z>0}.\]

Por fim, agrupando termos pares e ímpares temos: \[ \sum_{i=0}^n {n \choose i}b^{n-i} = b^n + \sum_{i=1}^{n}{n \choose i}b^{n-i} = b^n + \sum_{i=1}^{\lfloor n/2\rfloor} {n \choose 2i}b^{n-2i} + \sum_{i=1}^{\lfloor (n+1)/2 \rfloor} {n \choose 2i-1}b^{n-(2i-1)},  \]onde $\lfloor \cdot \rfloor$ é a \emph{função piso}.

\newpage

\begin{prop}[Existência de $\sqrt[n]{a}$, $a > 0$, $n \in \mathbb{Z}_{>0}$]
Sejam $a >0$ e $n \in \mathbb{Z}_{>0}$. Existe $b \in \R_{>0}$ tal que $b^n = a$.
\end{prop}

and my preamble:

\documentclass[a4paper, 12pt]{article}
\usepackage{amsmath, amssymb, amsfonts, amsthm}
\usepackage[brazil]{babel}
\usepackage[utf8]{inputenc}
\usepackage{indentfirst}
\usepackage{multicol}
\usepackage{gfsartemisia-euler}
\usepackage{graphicx}
\usepackage[T1]{fontenc}
\usepackage{stackrel}
\usepackage{cancel}
\usepackage{caption}
\usepackage{enumerate}
\usepackage{mathrsfs}
\usepackage[bottom=3cm,top=3cm,left=3cm,right=2cm]{geometry}

\headheight 20mm      %
\oddsidemargin 2.0mm  %
\evensidemargin 2.0mm %
\topmargin -40mm      %
\textheight 250mm     %
\textwidth 160mm      %


\newcommand\pair[1]{\langle{#1}\rangle}
\newcommand{\R}{\mathbb{R}}
\newcommand{\V}{\mathcal{V}}
\newcommand{\diag}{\mathrm{diag}}
\renewcommand{\d}{\mathrm{d}}
\DeclareMathOperator{\senh}{senh}
\DeclareMathOperator{\sen}{sen}
\DeclareMathOperator{\tg}{tg}
\DeclareMathOperator{\cotg}{cotg}

\newtheorem{teo}{Teorema}[section]
\newtheorem{cor}{Corolário}[section]
\newtheorem{lem}{Lema}[section]
\newtheorem{prop}{Proposição}
\newtheorem{defn}{Definição}[section]
\newtheorem{Ex}{Exemplo}[section]
\newtheorem{obs}{Observação}
\newtheorem{ex}{Exercício}

\newenvironment{dem}{\smallskip \noindent{\bf Demonstração}: }
{\begin{flushright} $\qedsymbol$\end{flushright}\smallskip}
4
  • Why not using the proof environment provided by amsthm? It manages the QED symbol much better.
    – egreg
    Commented Jul 11, 2015 at 20:04
  • I like leaving the Demonstration: in bold instead of italic, and I happened to found that preamble half-way ready, so I just go adding the stuff I need. That other environment was already made with what I wanted, so I just kept it, and I don't know how to edit the proofenvironment directly..
    – Ivo Terek
    Commented Jul 11, 2015 at 20:08
  • 1
    \newenvironment{dem}{\begin{proof}[\normalfont{\bfseries Demonstração}:]}{\end{proof}}
    – egreg
    Commented Jul 11, 2015 at 20:15
  • Thanks! I guess I can adapt this for other environments as needed, too.
    – Ivo Terek
    Commented Jul 11, 2015 at 20:18

2 Answers 2

4

An optional argument can't have a ] in it (because the parser thinks that's where the optional argument ends), but there are workarounds. In this case, I \def\tmp{\sqrt[n]} before the prop environment, and then use \tmp in the optional argument instead of \sqrt[n].

Alternately, it might be more readable to place the whole optional argument in \tmp, as in

\def\tmp{Existência de $\sqrt[n]{a}$, $a > 0$, $n \in \mathbb{Z}_{>0}$}
\begin{prop}[\tmp]
Sejam $a >0$ e $n \in \mathbb{Z}_{>0}$. Existe $b \in \R_{>0}$ tal que $b^n = a$.
\end{prop}

Here is the MWE.

\documentclass[a4paper, 12pt]{article}
\usepackage{amsmath, amssymb, amsfonts, amsthm}
\usepackage[brazil]{babel}
\usepackage[utf8]{inputenc}
\usepackage{indentfirst}
\usepackage{multicol}
\usepackage{gfsartemisia-euler}
\usepackage{graphicx}
\usepackage[T1]{fontenc}
\usepackage{stackrel}
\usepackage{cancel}
\usepackage{caption}
\usepackage{enumerate}
\usepackage{mathrsfs}
\usepackage[bottom=3cm,top=3cm,left=3cm,right=2cm]{geometry}

\headheight 20mm      %
\oddsidemargin 2.0mm  %
\evensidemargin 2.0mm %
\topmargin -40mm      %
\textheight 250mm     %
\textwidth 160mm      %


\newcommand\pair[1]{\langle{#1}\rangle}
\newcommand{\R}{\mathbb{R}}
\newcommand{\V}{\mathcal{V}}
\newcommand{\diag}{\mathrm{diag}}
\renewcommand{\d}{\mathrm{d}}
\DeclareMathOperator{\senh}{senh}
\DeclareMathOperator{\sen}{sen}
\DeclareMathOperator{\tg}{tg}
\DeclareMathOperator{\cotg}{cotg}

\newtheorem{teo}{Teorema}[section]
\newtheorem{cor}{Corolário}[section]
\newtheorem{lem}{Lema}[section]
\newtheorem{prop}{Proposição}
\newtheorem{defn}{Definição}[section]
\newtheorem{Ex}{Exemplo}[section]
\newtheorem{obs}{Observação}
\newtheorem{ex}{Exercício}

\newenvironment{dem}{\smallskip \noindent{\bf Demonstração}: }
{\begin{flushright} $\qedsymbol$\end{flushright}\smallskip}
\begin{document}
\def\tmp{\sqrt[n]}
\begin{prop}[Existência de $\tmp{a}$, $a > 0$, $n \in \mathbb{Z}_{>0}$]
Sejam $a >0$ e $n \in \mathbb{Z}_{>0}$. Existe $b \in \R_{>0}$ tal que $b^n = a$.
\end{prop}
\end{document}

enter image description here

2
  • Makes sense not repeating [ and ]. The problem is solved, thank you very much!
    – Ivo Terek
    Commented Jul 11, 2015 at 19:52
  • An extra macro is not needed (and might cause problems, although I did not check this) so I'd use the other answer instead.
    – YoungFrog
    Commented Jul 11, 2015 at 20:18
6

Just brace the offending bit:

\begin{prop}[Existência de {$\sqrt[n]{a}$}, $a > 0$, $n \in \mathbb{Z}_{>0}$]
Sejam $a >0$ e $n \in \mathbb{Z}_{>0}$. Existe $b \in \R_{>0}$ tal que $b^n = a$.
\end{prop}

The problem is that ] after n is otherwise taken as the closing delimiter for the optional argument. This is a common problem when a command with optional argument sits in an optional argument.

1
  • That's neat. I'll be sure to remember it too! :)
    – Ivo Terek
    Commented Jul 11, 2015 at 20:03

Not the answer you're looking for? Browse other questions tagged .