How should I define the indentation?
I tried
Code: Select all
\addtolength{\textwidth}{-5cm}%
Code: Select all
\addtolength{\parindent}{5cm}
Code: Select all
\addtolength{\textwidth}{-5cm}%
Code: Select all
\addtolength{\parindent}{5cm}
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
Code: Select all
\documentclass[a4paper,10pt,english]{article}
\usepackage{babel}
\usepackage{blindtext}
\newenvironment{myEnv}{\addtolength{\parindent}{5cm}}{}
\begin{document}
\blindtext
\vspace{2ex}
Here is the new environment, with left margin the same as regular text:
\vspace{2ex}
\begin{myEnv}
\noindent\blindtext
\end{myEnv}
\vspace{2ex}
\noindent Here is what I want to achieve with my new environment.
The following text is all indented:
\vspace{2ex}
\begin{minipage}{\dimexpr\textwidth-\parindent}
\blindtext
\end{minipage}
\end{document}
Code: Select all
\documentclass[11pt,a4paper,english]{article}
\usepackage[T1]{fontenc}
\usepackage{babel}
\usepackage{blindtext}
\parindent0em
\begin{document}
\hangindent2em
\hangafter=0
\blindtext
\medskip
\blindtext
\end{document}
So please tell us for what purposes the environment is created. What is it for? What will it do? At the moment you only want indentation. For this single purpose you don't need a new environment. Just list all desired properties of your environment and we will see how we can implement them.Willie wrote:[…] The environment was not created solely for this purpose, but I want the presented text to be indented. […]
The purpose is not relevant for the answer, however the purpose is: an enviroments for writing "examples". I want it to behave just like minipages with respect to indentation, as in my code above, with the only difference it could be page-broken.localghost wrote:So please tell us for what purposes the environment is created. What is it for? What will it do? At the moment you only want indentation. For this single purpose you don't need a new environment. Just list all desired properties of your environment and we will see how we can implement them.Willie wrote:[…] The environment was not created solely for this purpose, but I want the presented text to be indented. […]
Code: Select all
\newenvironment{myEnv}{\begin{parbox}{0.7\textwidth}}{\end{parbox}}
Code: Select all
\documentclass[a4paper,10pt]{article}
\usepackage[english]{babel}
\usepackage{blindtext}
\parindent0em
\parskip\baselineskip
\begin{document}
\blindtext[3]
\par
\begingroup
\leftskip4em
\rightskip\leftskip
\blindtext[3]
\par
\endgroup
\blindtext
\end{document}
This DOES seem to be what I want. However I can't get it to work when defined inside my new environment. for example:Stefan_K wrote:You could change \leftskip in that environment, such as here, where you can see indentation across a page break:
Source: Changing margins for just one paragraph.Code: Select all
\documentclass[a4paper,10pt]{article} \usepackage[english]{babel} \usepackage{blindtext} \parindent0em \parskip\baselineskip \begin{document} \blindtext[3] \par \begingroup \leftskip4em \rightskip\leftskip \blindtext[3] \par \endgroup \blindtext \end{document}
Stefan
Code: Select all
\newenvironment{myEnv}{\leftskip4em \rightskip\leftskip}{}
Code: Select all
\newenvironment{myEnv}{\begin{parbox}{0.5\linewidth}}{\end{parbox}}
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