I once defined a customized latex command, which works well. And now I would like to convert it into a latex environment using \newenvironment command. However, I failed after trying several ways. Could you help me, please?
The definition of my own latex command is
\newcommand{\smallbox}[1]{
\tikzstyle{mybox} = [draw=red, rectangle,inner sep=5pt, inner ysep=5pt]
\begin{center}
\begin{tikzpicture}
\node [mybox] (box){
\begin{minipage}{0.85\textwidth}
#1
\end{minipage}
};
\end{tikzpicture}
\end{center}
}
Let's call the to-be-defined enviroment "smallenvironment" for the moment.
And I would like that, the following command
\smallbox{This is a small box!}
is equivalent to
\begin{smallenvironment}
This is a small box!
\end{smallenvironment}
Thanks!
\documentclass{...}
, the required\usepackage
's,\begin{document}
, and\end{document}
. That may seem tedious to you, but think of the extra work it represents for TeX.SX users willing to give you a hand. Help them help you: remove that one hurdle between you and a solution to your problem.mdframed
package instead?\tcolorbox
package, e.g.?