Graphics, Figures & TablesNew environment using the old one

Information and discussion about graphics, figures & tables in LaTeX documents.
Post Reply
Yeats
Posts: 62
Joined: Fri Nov 07, 2008 12:29 pm

New environment using the old one

Post by Yeats »

Hi,

I need to create a new environment completely the same as the old one. Here is what I mean: I need two different quote environments one which I would use with \begin{quote} and another that would be the same but I would use \begin{source} command instead.

Does anyone know how to include the old environment in the \newenvironment command?

Thanks!
Last edited by cgnieder on Fri May 03, 2013 9:56 am, edited 1 time in total.

Recommended reading 2024:

LaTeXguide.org • LaTeX-Cookbook.net • TikZ.org

Learn LaTeX easily with newest books:

The LaTeX Beginner's Guide: 2nd edition and perfect for students writing a thesis

The LaTeX Cookbook: 2nd edition full of practical examples for mathematics, physics, chemistry, and more

LaTeX Graphics with TikZ: the first book about TikZ for perfect drawings in your LaTeX thesis

User avatar
cgnieder
Site Moderator
Posts: 2000
Joined: Sat Apr 16, 2011 7:27 pm

New environment using the old one

Post by cgnieder »

Hi Yeats,

Welcome to the LaTeX community!

What the command \begin{env} does apart from opening a group and setting the current environment name is issuing the command \env. The \end{env} checks if the currently open environment matches, calls \endenv and closes the group (roughly speaking). So the standard way to create a wrapper environment is to call the commands \env and \endenv in the \newenvironment statement:

Code: Select all

\documentclass{article}

\newenvironment{source}{\quote}{\endquote}

\usepackage{kantlipsum}% dummy text

\begin{document}

\kant[1]

\begin{source}
 \kant[2-3]
\end{source}

\kant[4]

\end{document}
Regards
site moderator & package author
Yeats
Posts: 62
Joined: Fri Nov 07, 2008 12:29 pm

Re: New environment using the old one

Post by Yeats »

Thank you very much for the fast answer! This solved my problem and its so simple! Sometimes the simplest things are so hard to find (and I did a thorough search before posting here). Thanks again!
Post Reply