3

the regular behaviour is that a new textblock gets indent on the first line. Which is great.

But I want for certain textblock (not default for the whole document) the exact opposite behaviour. Meaning the first line should not get indent, but all the lines below.

Like shown here:

Lorem ipsum dolor sit amet, consectetur adipisicing elit, 
    sed do eiusmod tempor incididunt ut labore et dolore
    magna aliqua. Ut enim ad minim veniam, quis nostrud 
    exercitation ullamco laboris nisi ut aliquip ex ea 
    commodo consequat.

is it somehow possible? I'm using \documentclass{scrbook} if it matter.


Update: please note that my first line contains a \paragraph headline.

E.g.:

\documentclass{scrbook}
\usepackage{lipsum}
\begin{document}
    \lipsum[1]

    \paragraph{my paragraph} \lipsum[2]

    \lipsum[3]
\end{document}
4

Paragraph shapes can be changed using the \parshape primitive:

enter image description here

\documentclass{scrbook}

\usepackage[nopar]{lipsum}

\begin{document}

\lipsum[1]

\paragraph{Some paragraph heading}
\parshape % Change the shape of the following paragraph
  2 % Identify the shape by specying 2 lines
  0pt \linewidth % First line has a left indent of 0pt and a width of \linewidth
  \parindent \dimexpr\linewidth-\parindent % Second (and subsequent lines) have an indent of \parindent
                                           % and a width of \linewidth-\parindent
\lipsum[2]  % Set paragraph with new paragraph shape

\lipsum[3]

\end{document}

We change the \parshape after initiating the \paragraph heading.

5
\documentclass{scrbook}
\usepackage{lipsum}
\parskip=1em
\begin{document}
\lipsum[1]

{\leftskip=\parindent
\parindent=-\leftskip
\lipsum[2]}

\lipsum[3]
\end{document}

enter image description here


FOLLOW UP

For a \paragraph starter: add the line \expandafter\def\csname scr@paragraph@sectionindent\endcsname{-\dimexpr\svparindent\relax} into the mix, after previously saving the default \parindent in \svparindent.

\documentclass{scrbook}
\usepackage{lipsum}
\usepackage[T1]{fontenc}
\edef\svparindent{\the\parindent}
\begin{document}
    \lipsum[1]

{\leftskip=\parindent
\parindent=-\leftskip
\expandafter\def\csname scr@paragraph@sectionindent\endcsname{-\svparindent}%
    \paragraph{my paragraph} \lipsum[2]
}

    \lipsum[3]
\end{document}

enter image description here

  • thx. the result looks exactly how I want to have it. BUT the \parskip=1em increases the vertical distance between ALL textblocks as well. Do you know how to avoid this? – user1234 Jul 21 '17 at 18:27
  • 2
    @user2798895: That was most likely just to highlight the difference by adding some separation between the paragraphs. You don't need to change \parskip in your application. – Werner Jul 21 '17 at 18:28
  • @user2798895 What he said ^^^. – Steven B. Segletes Jul 21 '17 at 18:29
  • sorry I mixed up parskip and parindent while reading. Your sample is working very well. But my code has a paragraph.Having this, your answer is not working anymore. Do you know how it will work for this as well? (I updated the question) – user1234 Jul 21 '17 at 18:36
  • 1
    @user2798895 Please see my edit. – Steven B. Segletes Jul 21 '17 at 18:49
1

The hanging package is pretty good - and easy

\documentclass{article}
\usepackage{hanging}

\begin{document}

\hangpara{3em}{-3}You can also use the hanging macro directly from the package if don't want my autowidth eg several hangs of the same width
hangpara is called as width and then a positive value indents the left a negative intends at the right of the text
The second parameter is nthe number of lines toi indent . If positive, then the lines after N will be indented. If negative the first N lines will be indented. 
NB Must be no linebreak between hangpara command and the text (or use a percent sign)

\bigskip

\hangpara{3em}{3}You can also use the hanging macro directly from the package if don't want my autowidth eg several hangs of the same width
hangpara is called as width and then a positive value indents the left a negative intends at the right of the text
The second parameter is nthe number of lines toi indent . If positive, then the lines after N will be indented. If negative the first N lines will be indented. 
NB Must be no linebreak between hangpara command and the text (or use a percent sign)

\bigskip

\hangpara{8em}{-1}You can also use the hanging macro directly from the package if don't want my autowidth eg several hangs of the same width
hangpara is called as width and then a positive value indents the left a negative intends at the right of the text

\bigskip

\hangpara{8em}{1}You can also use the hanging macro directly from the package if don't want my autowidth eg several hangs of the same width
hangpara is called as width and then a positive value indents the left a negative intends at the right of the text
The second parameter is nthe number of lines toi indent . 

\end{document}

enter image description here

  • its definitely the best readable version. But its not working anymore when using a \paragraph within the textblock. (like the update I added yesterday) – user1234 Jul 22 '17 at 16:23

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.