[Tex/LaTex] Indent paragraph both on the left and right without any external packages

indentationparagraphs

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

Best Answer

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

enter image description here

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}
Related Question