Take the 2-minute tour ×
TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

I wrote some things and wanted to have a part of those left aligned and on the same line some words (or formulas) right aligned. I solved that with \hfill.
So sad it is not working on the last line before the end of paragraph when using parskip=half. How can I change that?
For clarification a mwe:

\documentclass[parskip=half]{scrartcl}
\usepackage{polyglossia}\setdefaultlanguage[spelling=new,babelshorthands=true]{german} 
\RequirePackage{mathtools,amsfonts}
\begin{document}
\section{Test}
\paragraph*{Par one}
\(\displaystyle\iint_{G_x}f\,\mathrm{d}G=\int_{a}^{b}\int_{\psi_1\left(x\right)}^{\psi_2\left(x\right)}f\left(x,y\right)\,\mathrm{d}y\,\mathrm{d}x,\hfill f\text{ stetig auf }G_x\)\\
\hbox{\hskip0pt}\hfill\(\displaystyle\iint_{G_y}f\,\mathrm{d}G=\int_{c}^{d}\int_{\varphi_1\left(y\right)}^{\varphi_2\left(y\right)}f\left(x,y\right)\,\mathrm{d}x\,\mathrm{d}y,\hfill f\text{ stetig auf }G_y\)
\paragraph*{Par Two}\hfill\(\displaystyle\iiint f\left(x,y,z\right)\,\mathrm{d}x\,\mathrm{d}y\,\mathrm{d}z=\iiint f\left(u,v\right)\left\lvert\det\frac{\partial\left(x,y,z\right)}{\partial\left(u,v,w\right)}\right\rvert\,\mathrm{d}u\,\mathrm{d}v\,\mathrm{d}w
\)
\end{document}

And here is the result: Please have a look at the second line of Par one. problem figure

share|improve this question
    
parskip=half doesn't seem to affect anything like that... the \hbox{\hskip0pt}\hfill at the beginning of the second line will make it always be alligned like that. If what you want is to keep things aligned, maybe you should try to wrap into a table or something like that. –  henrique Feb 23 '12 at 11:18
    
@henrique sorry, you are wrong (please try): When removing \hbox{\hskip0pt}\hfill only that left alignment is changed (and of course the space in the middle), but I'm worrying about the right alignment - it should be like in the first line of Par one. –  Bastian Ebeling Feb 23 '12 at 11:50
    
I'm sorry, I though you meant the left alignment. Adding a \\ or \par after the last line should correct the right alignment. –  henrique Feb 23 '12 at 12:07
    
@henrique thanks. But your way inserts the parskip length (vertical) - what is not wanted. lockstep found a solution. –  Bastian Ebeling Feb 23 '12 at 12:41
add comment

1 Answer 1

up vote 1 down vote accepted

With one of the parskip options enabled, KOMA-Script will add a space of at least 1em at the end of each paragraph "[i]n order to avoid a change of paragraph going unnoticed, for instance after a page break" (manual, p. 50). This is done -- and can be undone -- by changing the \parfillskip (rubber) length.

\documentclass[parskip=half]{scrartcl}
% \usepackage{polyglossia}\setdefaultlanguage[spelling=new,babelshorthands=true]{german} 
\RequirePackage{mathtools,amsfonts}
\AtBeginDocument{\setlength{\parfillskip}{0pt plus 1fil}}% instead of 1em plus 1fil
\begin{document}
\section{Test}
\paragraph*{Par one}
\(\displaystyle\iint_{G_x}f\,\mathrm{d}G=\int_{a}^{b}\int_{\psi_1\left(x\right)}^{\psi_2\left(x\right)}f\left(x,y\right)\,\mathrm{d}y\,\mathrm{d}x,\hfill f\text{ stetig auf }G_x\)\\
\hbox{\hskip0pt}\hfill\(\displaystyle\iint_{G_y}f\,\mathrm{d}G=\int_{c}^{d}\int_{\varphi_1\left(y\right)}^{\varphi_2\left(y\right)}f\left(x,y\right)\,\mathrm{d}x\,\mathrm{d}y,\hfill f\text{ stetig auf }G_y\)
\paragraph*{Par Two}\hfill\(\displaystyle\iiint f\left(x,y,z\right)\,\mathrm{d}x\,\mathrm{d}y\,\mathrm{d}z=\iiint f\left(u,v\right)\left\lvert\det\frac{\partial\left(x,y,z\right)}{\partial\left(u,v,w\right)}\right\rvert\,\mathrm{d}u\,\mathrm{d}v\,\mathrm{d}w
\)
\end{document}

enter image description here

share|improve this answer
    
There exist even an KOMA-option:parskip=half- instead of parskip=half. Now, the last line of an paragraph can use the full textwidth. –  Michael P Jul 17 at 11:26
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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