# How to set lengths only for a specific environment (parindent for paracol in this case)?

Is it possible to set a length specifically for an environment? I know it is possible to change lengths for parts of the document only, by placing the \setlength command between {}, but when using an environment many times in a document, it would be quite cumbersome to set the length as many times as the environment is used.

In my specific case I would like to change \parindent only for the paracol environment, but not for the rest of the document. An MWE of my problem is this.

\documentclass[a4paper]{article}
\usepackage{paracol,lipsum,microtype}
\usepackage[norsk,british]{babel}
\usepackage[utf8]{inputenc}
\begin{document}
\lipsum[1]
\begin{paracol}{2}
\selectlanguage{norsk} Universitetet i Oslo ble opprettet 2. september 1811, eller det vil si: Den gangen het det Det kongelige Frederiks Universitet, og det gjorde det helt frem til 1939.
\switchcolumn
\selectlanguage{british} The University of Oslo was founded the second of september 1811, or actually: then it was called The royal Frederiks University, and it did so until 1939.
\switchcolumn*
\selectlanguage{norsk} Påls mor ble født syv år senere, unnfanget i de elleville fredsdager, født en kald februarlørdag i 1946.
\switchcolumn
\selectlanguage{british} Paul's mother was born seven years earlier, conceived during those wild days of peace, born on a cold february saturday in 1946.
\end{paracol}
\end{document}


The \parindent should be maintained at the green block, but be removed at the red blocks. How does one change this length only for the paracol environment, and for all paracol environments that are used throughout the document?

Since environments define a group, you can update/define commands within it and it will remain local to that environment. So setting \parindent to 0pt inside paracol would suffice.

### Global approach

For a more global approach, adding

\usepackage{etoolbox}% http://ctan.org/pkg/etoolbox
\AtBeginEnvironment{paracol}{\setlength{\parindent}{0pt}}


works and provides a consistent non-invasive way of achieving your goal.

### Local/manual approach

Start each paracol with

\begin{paracol}{<num>}
\setlength{\parindent}{0pt}%
...
\end{paracol}


In both instances, the result yields:

• It is that last bit about the global approach that does it (and beautifully, without any hacking with renewing environments and all), may I suggest placing that on top? – Betohaku May 9 '13 at 21:16
• @Betohaku: Since these posts may be applicable to a wider audience, others may want more localized control over settings. We can keep it this way until the universe decides otherwise. :) – Werner May 9 '13 at 21:24
• Of course the placing on top was meant for the audience as well, as it wouldn't do anything for me now anymore, would it? :p I just wondered the global thing would match the question (which is about global settings) better. Thanks again. – Betohaku May 9 '13 at 21:29
• @Betohaku: Okay, I've shortened the post with the global approach first, followed by a manual/local approach. – Werner May 9 '13 at 21:32