I am aware that this is a hyper specific question but I have been playing around with making all paragraphs perfect rectangles just like in this StackExchange question. And as in these older threads I am experiencing the same problems. But I am still trying to make them less bad.
- The first problem is probably easier to fix: The changes to parfillskip and the other parameters do not take affect in any environments like enumerate and itemize in the example below. But I also want to have rectangular paragraphs there.
- This is probably much harder to fix and just an idea of mine. Is it possible to make the changes to the lengths only apply when the paragraph exceeds a certain length? Maybe there is some way to get the length of a paragraph to then only use the \setlength in the preamble when the length is greater than some given length.
I am also aware that this is not exactly what is intended with LaTeX as the looks should be the less important part but I still want to experiment a bit with it.
Here is a minimal working example which shows the problems
\documentclass[a4paper]{article}
\usepackage{blindtext}
\usepackage{lmodern}
\usepackage[stretch=30]{microtype}
\usepackage{etoolbox}
% Enbale rectangular paragraphs
\setlength{\parindent}{0pt}
\setlength{\parskip}{.5\baselineskip}
\setlength{\parfillskip}{0pt}
\setlength{\emergencystretch}{.5\textwidth}
\makeatletter
\patchcmd{@sect}{\begingroup}{\begingroup\parfillskip=0pt plus 1fil\relax}{}{}
\patchcmd{@ssect}{\begingroup}{\begingroup\parfillskip=0pt plus 1fil\relax}{}{}
\makeatother
\begin{document}
Too short paragraph that gets ruined and where the changed lengths should not apply
\section{Lorem ipsum}
\blindtext
\begin{itemize} % No affect here
\item \blindtext
\end{itemize}
\begin{enumerate} % No affect here
\item \blindtext
\end{enumerate}
\end{document}