3

I have the following texts. My problem is that between my text and myothertext a distance is inserted that is about the equal of a full line. As I want to avoid this but not sure as to how I can do that my question is how can I reduce this vertical distance?

Mytext
\begin{addmargin}[0.3cm]{0cm}
    MyOtherText
\end{addmargin}

for the documentclass I'm using its this one:

\documentclass[8pt,a4paper,BCOR10mm,DIV11,toc=listof,parskip=full, openany]{scrbook}
7
  • Where does addmargin come from? I suspect some \abovedisplayskip etc. to be changed, but without knowing the package...
    – user31729
    Jun 21, 2015 at 8:51
  • you mean which documentclass I'm using? else addmargin is a standard thing (like itemize) where I don't need to import additional things.
    – Thomas
    Jun 21, 2015 at 8:52
  • Nope, addmargin is an KOMA extension, apparently. It's not in the LaTeX kernel or in the standard classes ;-)
    – user31729
    Jun 21, 2015 at 8:55
  • that is the default behaviour. addmargin starts a new paragraph and with your setting of parksip=full you'll get an empty line for the paragraph skip.
    – user2478
    Jun 21, 2015 at 8:55
  • @ChristianHupfer ah sorry overlooked that (didn't see that when I looked it up).
    – Thomas
    Jun 21, 2015 at 8:57

2 Answers 2

1
\documentclass[parskip=full,]{scrartcl}
\makeatletter
\let\@addmarginORIG\@addmargin
\renewcommand*\@addmargin{%
    \vspace{-\bigskipamount}
    \@addmarginORIG}
\makeatother
\begin{document}

Mytext
\begin{addmargin}[0.3cm]{0cm}
        MyOtherText
\end{addmargin}

\end{document}
1
  • That worked tnx. (for me in particular it was medskipamount but that aside works nicely tnx)
    – Thomas
    Jun 21, 2015 at 9:09
4

You are using parskip=full and scrbook duly obeys it: addmargin starts a new paragraph and so it is separated from the preceding paragraph with a full parskip.

If you want to remove the parskip in your addmargin environment, I suggest you to define a new environment.

\documentclass[
  parskip=full
]{scrartcl}

\newenvironment{thomasaddmargin}
 {\setlength{\parskip}{0pt plus 1pt}\addmargin}
 {\endaddmargin}

\begin{document}

Mytext
\begin{thomasaddmargin}[0.3cm]{0cm}
MyOtherText
\end{thomasaddmargin}

Mytext

Mytext

\end{document}

If you want to follow the “remove the vertical space approach”, you have to patch the right command, which is not \@addmargin, but the internal one called by it. This is easy with xpatch; note that the glue to remove is \parskip, not \bigskipamount.

\documentclass[
  parskip=full
]{scrartcl}

\usepackage{xpatch}

\makeatletter
\pretocmd{\@addmargin}{\vspace{-\parskip}}{}{}
\makeatother

\begin{document}

Mytext
\begin{addmargin}[0.3cm]{0cm}
MyOtherText
\end{addmargin}

Mytext

Mytext

\end{document}

The output is the same because there is only one paragraph in the addmargin environment.

The difference between the two solutions is that in the former no parskip will be used between paragraphs inside addmargin; the normal parskip will be used in the latter solution. Take your pick.

Final exhortation: don't use parskip=full.

1
  • The sad thing is, that apparently the OP didn't upvote any answer :-( +1 though, not just for the very last line :-)
    – Johannes_B
    Jun 21, 2015 at 11:15

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.