5

I'm writing a document in English which includes an abstract in Spanish. In Spanish the first paragraph of a chapter should be indented, while in English shouldn't.

If I use indentfirst package, all first paragraphs in the document would be indented.

How can I indent a first paragraph only once, i.e., without affecting other first paragraphs in the document?

EDIT: I only want to indent the first line of paragraphs. \indent doesn't do the job, maybe because it's overridden to not indent first paragraphs.

4
  • 1
    Why not use \indent?
    – fefe
    Apr 23, 2012 at 12:04
  • I think because he wants the whole paragraph to be indeted, not the first line only.
    – Ray
    Apr 23, 2012 at 12:16
  • I want to indent only the first line. \indent doesn't work, I suppose because it's overriden to not indent the first paragraph.
    – Jose
    Apr 23, 2012 at 12:33
  • @Jose In this case you should really edit your question accordingly since it says "How can I indent a first paragraph only once".
    – Ray
    Apr 23, 2012 at 12:40

3 Answers 3

13

\indent does not work as the code LaTeX inserts to remove the indentation after a section heading really does remove the indentation box, even if added explicitly.

Try

\section{hhh}
\hspace*{\parindent}aa bb ccaa 
0
4

Add to the code executed when entering Spanish what's done by indentfirst; we do also the converse, when exiting Spanish.

\documentclass{article}
\usepackage[spanish,english]{babel}
\makeatletter
\let\original@afterindentfalse\@afterindentfalse
\addto{\extrasspanish}{\let\@afterindentfalse\@afterindenttrue}
\addto{\noextrasspanish}{\let\@afterindentfalse\original@afterindentfalse}
\makeatother
\usepackage{lipsum}
\begin{document}
\begin{otherlanguage}{spanish}
\section{\abstractname}
\lipsum[2]
\end{otherlanguage}

\lipsum[3]
\end{document}
2
  • yes +1 for me as no one else had, and this is of course the right way to do it if you have lots of spanish and english sections. If it's just a single abstract though, I thought the hspace was simpler even if it does pollute the document markup a bit. Apr 23, 2012 at 15:30
  • @DavidCarlisle Of course: one single indent does not require a complicated solution. I'd be even more drastic: if the base language is English, follow the conventions of English.
    – egreg
    Apr 23, 2012 at 16:35
0

You could set up a new environment if you would like to indent a full paragraph.

\newenvironment{myindentpar}[1]
 {\begin{list}{}
         {\setlength{\leftmargin}{#1}}
         \item[]
 }
 {\end{list}}

Then you could call this environment by

\begin{myindentpar}{3cm}
text text text...
\end{myindentpar}

In case you just want to indent a single line I would suggest the \indent command.

Source

1
  • Thanks for the answer, but yes, I want to indent only the first line. \indent doesn't do the job, maybe because it's overriden to not indent the first paragraph?
    – Jose
    Apr 23, 2012 at 12:35

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .