1

I created the following environment:

\newenvironment{symmetric}{
\Ifthispageodd{\begin{addmargin}[-1cm]{2cm}\RaggedLeft}{\begin{addmargin}[2cm]{-1cm}}
}
{\end{addmargin}\justify}

Works as I thought, but but it fails (as i supposed) as page breaks.

There seems to be no automatic solution, but maybe a hint, or Lua magic?

Similar problem:

different text alignment on even/odd pages (like raggedouter but for text)

Example:

%!TEX TS-program = lualatex
%!TEX encoding = UTF-8 Unicode

\documentclass[mpinclude=true,  version=last, chapterprefix=true, paper=b5]{scrbook}
     \KOMAoptions{
         DIV=classic,
        twoside=true, 
     }

\usepackage[tracking=smallcaps, protrusion=true,expansion=true,final]{microtype}

\usepackage{ragged2e}

\newenvironment{symmetric}{
\Ifthispageodd{\begin{addmargin}[0cm]{2cm}\RaggedRight}{\begin{addmargin}[2cm]{0cm}\RaggedLeft}
}
{\end{addmargin}\justify}

\linespread{1.15}

\begin{document}
\section{section 1}
Lorem ipsum dolor sit amet, consectetur adipiscing elit. Integer id felis convallis, tempus purus sed, rhoncus est. Praesent placerat tellus felis, at pretium massa finibus vel. Sed vel mi vitae urna sagittis iaculis quis non magna. Integer a laoreet libero. Phasellus maximus odio id blandit mollis. Pellentesque varius eleifend nibh. Vestibulum iaculis dignissim leo. Phasellus velit nisi, interdum pellentesque auctor porta, tempor at magna. Suspendisse et eleifend ligula. Duis vestibulum placerat quam, a malesuada leo pharetra non. Aenean id dignissim felis, non hendrerit lorem. Curabitur ipsum justo, pharetra dapibus mattis vitae, venenatis non justo. Quisque sit amet nunc non leo pretium iaculis in in nisi.
\begin{symmetric}
Lorem ipsum dolor sit amet, consectetur adipiscing elit. Integer id felis convallis, tempus purus sed, rhoncus est. Praesent placerat tellus felis, at pretium massa finibus vel. Sed vel mi vitae urna sagittis iaculis quis non magna. Integer a laoreet libero. Phasellus maximus odio id blandit mollis. Pellentesque varius eleifend nibh. Vestibulum iaculis dignissim leo. Phasellus velit nisi, interdum pellentesque auctor porta, tempor at magna. Suspendisse et eleifend ligula. Duis vestibulum placerat quam, a malesuada leo pharetra non. Aenean id dignissim felis, non hendrerit lorem. Curabitur ipsum justo, pharetra dapibus mattis vitae, venenatis non justo. Quisque sit amet nunc non leo pretium iaculis in in nisi.
Lorem ipsum dolor sit amet, consectetur adipiscing elit. Integer id felis convallis, tempus purus sed, rhoncus est. Praesent placerat tellus felis, at pretium massa finibus vel. Sed vel mi vitae urna sagittis iaculis quis non magna. Integer a laoreet libero. Phasellus maximus odio id blandit mollis. Pellentesque varius eleifend nibh. Vestibulum iaculis dignissim leo. Phasellus velit nisi, interdum pellentesque auctor porta, tempor at magna. Suspendisse et eleifend ligula. Duis vestibulum placerat quam, a malesuada leo pharetra non. Aenean id dignissim felis, non hendrerit lorem. Curabitur ipsum justo, pharetra dapibus mattis vitae, venenatis non justo. Quisque sit amet nunc non leo pretium iaculis in in nisi.
\end{symmetric}
\section{section 2}
Lorem ipsum dolor sit amet, consectetur adipiscing elit. Integer id felis convallis, tempus purus sed, rhoncus est. Praesent placerat tellus felis, at pretium massa finibus vel. Sed vel mi vitae urna sagittis iaculis quis non magna. Integer a laoreet libero. Phasellus maximus odio id blandit mollis. Pellentesque varius eleifend nibh. Vestibulum iaculis dignissim leo.
\begin{symmetric}
Lorem ipsum dolor sit amet, consectetur adipiscing elit. Integer id felis convallis, tempus purus sed, rhoncus est. Praesent placerat tellus felis, at pretium massa finibus vel. Sed vel mi vitae urna sagittis iaculis quis non magna. Integer a laoreet libero. Phasellus maximus odio id blandit mollis. Pellentesque varius eleifend nibh. Vestibulum iaculis dignissim leo.
\end{symmetric}
\end{document}
  • 3
    changing the margins (if you do not change the width of the text block) on odd and even pages is easy and doesn't require any testing, changing the width of the text block or the alignment mid-paragraph at a page break is tricky (and likely to be incompatible with other code in the document in general so a real example would be useful) . Do you really want to switch between ragged left and justified text within the same paragraph? – David Carlisle May 1 at 8:53

Your Answer

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

Browse other questions tagged or ask your own question.