Take the 2-minute tour ×
TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

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?

share|improve this question
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
add comment

2 Answers 2

up vote 5 down vote accepted

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>}.

share|improve this answer
add comment

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.

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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