5

I want to define my own environment, like

\newenvironment{question}
{\begin{tiny}}
{\end{tiny}}

That may not make much sense, but it works. How can I do the same with bold font?

  • 1
    There is no environment tiny. There is a command \tiny. The same can be achieved with \bfseries: \newenvironment{foo}{\bfseries}{} – Marco Daniel Dec 10 '13 at 20:55
7

You need to use a "switch", achieved by issuing \bfseries at the start of the environment (say boldenv):

\newenvironment{boldenv}
  {\bfseries}% \begin{boldenv}
  {}% \end{boldenv}

The scope of this switch is limited to the environment, since \begin{boldenv} ... \end{boldenv} naturally forms a group. Also, italicized text inside this environment will inherit the bold switch (for example, if you use \textit{<stuff>}). To avoid this, you'd have to restore the font using something like {\normalfont\itshape <stuff>}.

6

There is no environment tiny. There is a command \tiny. The same can be achieved with \bfseries: \newenvironment{foo}{\bfseries}{}


I think it's important to mention a fact which is mostly unknown: Don't use font commands as environments.

Explanation:

Let me start with a small example and the unwanted output:

\documentclass{article}
\usepackage[ngerman]{babel}
\usepackage{blindtext}
\begin{document}
\blindtext
\begin{quote}\tiny\blindtext\end{quote}
\blindtext
\begin{quote}\begin{tiny}\blindtext\end{tiny}\end{quote}
\end{document}

enter image description here

What happened

First you can see the different line spacing. In the first example (the correct one) \begin{quote}\tiny\blindtext\end{quote} the command \par is executed with the font size \tiny. So the space is correct. In the second example \begin{quote}\begin{tiny}\blindtext\end{tiny}\end{quote} the inner environment makes a local switch to \tiny and the closing \par by quote uses the default font size. So the complete paragraph is getting the wrong spacing.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.