# Indent paragraph both on the left and right without any external packages

I am following the AAAI 19 Template from https://aaai.org/Conferences/AAAI-19/aaai19call/ where a text abstract is supposed to be formatted in a way that it is indented 10pt to the left and 10pt to the right.

Currently, I have the following:

\hangindent=10pt \emph{text} \\


This indents the left part. I know I can indent right with \hangindent=-10pt but if I combine both only the last one is used.

I know there is \leftskip and \rightskip commands, but if I use them before my paragraph, they suddently apply to not just the paragraph but the whole text afterwards.

\leftskip=10pt \rightskip=10pt \emph{text} \\
some other text that also gets left and right margins, which it shouldn't.


I saw an example where you can use \addtolength command to set indents to one paragraph only, but the template forbids using the \addtolength command in the paper. So, something like this is apparently not allowed:

{\addtolength{\leftskip=10pt\rightskip=10pt}{mytext}} % don't remember the exact example


\setlength is also forbidden.

I can't find any other solution.

EDIT: I also tried groups:

\begingroup \leftskip=10pt \rightskip=10pt \emph{text} \endgroup \\
in this case nothing happens at all, indents don't work

• Did you try \leftskip, \rightskip and the paragraph in a group? Aug 17 '18 at 22:02
• @Bernard the grouping does not do anything at all in my case. Maybe I did it wrong. I added an edit with an example Aug 17 '18 at 22:03
• Very simple: \begin{quoting}[leftmargin=10pt, rightmargin=10pt] ... end{quoting}. You see more details on the parameters in the documentation. Aug 17 '18 at 22:23
• After changing \leftskip and \rightskip to affect a paragraph (they affect whole paragraphs at a time), the change stays in force until you reset them to 0pt afterwards. Aug 17 '18 at 23:57
• The page you link to has a template for LaTeX submissions. You should use that. I can't see where the parameters you mention are specified. Aug 18 '18 at 18:06

\leftskip and \rightskip have to be undone after you are through with them. Note that they affect whole paragraphs and cannot be used to change indentation for parts of a paragraph.

\documentclass{article}
\usepackage{lipsum}

\begin{document}
\lipsum[1]

\leftskip1cm\relax
\rightskip1cm\relax
\lipsum[2]

\leftskip0cm\relax
\rightskip0cm\relax
\lipsum[3]
\end{document}


Here it is as the myindent environment:

\documentclass{article}
\usepackage{lipsum}
\newenvironment{myindent}
{\par\leftskip1cm\relax\rightskip1cm\relax}
{\par\leftskip0cm\relax\rightskip0cm\relax}
\begin{document}
\lipsum[1]
\begin{myindent}
\lipsum[2]
\end{myindent}
\lipsum[3]
\end{document}

• If you show how to make this an environment (which will remove the need to undo the values) I think this will solve the OPs problem. Aug 18 '18 at 13:33

There is an alternative:

{\leftskip=1cm\relax
\rightskip=1cm\relax
text
\par}

• There are numerous instances of this use of commands in the literature, that is without the \relax command, and I have no problems using them that way myself; what could be the necessity for this addition ?
– LPH
Aug 18 '18 at 21:20