I want to define an environment with something like a style. That is, when putting any paragraph in that environment, it applies various formats.
For example:
- I want the text to appear in a certain font
- that it has a specific color, defined within the environment and if possible using a command where I define the color
- appear in large size
- appear in bold
- that is not indented
- to add an additional space with respect to the next paragraph
- etc.
I've seen some answers here, and I've written this code:
\newenvironment{redtitle}{%
%\bgroup
\par
\fontfamily{ptm}\selectfont \noindent \textcolor{red} \textbf
}
{%
\par %\egroup
}
This is the snippet where I try to apply it:
\begin{redtitle}
Some nifty code and stuffz
\end{redtitle}
I'm getting this error:
! Argument of \textbf has an extra }. \par l.230 \begin{redtitle} I've run across a
}' that doesn't seem to match anything. For example,
\def\a#1{...}' and\a}' would produce this error. If you simply proceed now, the
\par' that I've just inserted will cause me to report a runaway argument that might be the root of the problem. But if your}' was spurious, just type
2' and it will go away.Runaway argument? ! Paragraph ended before \textbf was complete. \par l.230 \begin{redtitle} I suspect you've forgotten a `}', causing me to apply this control sequence to too much text. How can we recover? My plan is to forget the whole thing and hope for the best.
Then, how I can achieve this?
I'm new to LaTeX, so if you see any bad practices or is there a better way to do this, I appreciate your feedback.
\textbf
with\bfseries
?