I'm trying to make a "custom" environment for my document, here's what i got
\documentclass[12pt]{article}
\usepackage{color}
\definecolor{01}{RGB}{0,95,200}
\newenvironment{custom}[2]{{\medskip\noindent\bf\color{01} #1}\\{\it #2 }}{}
\begin{document}
\begin{custom}{Observation}
$x\in Z(G)$ si y solo si $xy=yx$, para todo $y\in G$ si y solo si $N(x)=G$, si y solo si \[\frac{o(G)}{o(N(x))}=1=|[x]|.\]
\end{custom}
\end{document}
which had no problems, but in this case, since the text starts with a "$" symbol, i get an error,
Extra }, or forgotten $. [$] Missing } inserted. [\end{custom}]
Which i can avoid by putting everything on {} like
\begin{custom}{a}
{b}
\end{custom}
But I was wondering if there is a way I can modify the \newenvironment
to make it work without having to make any changes, thanks in advance.
\bf
and\it
are outdated commands, but that's not the cause of your problem: You define with 2 arguments but provide only one, the second tries to read$
, getting you into troublestheorem
like environment rather than a\newenvironment
here