\usepackage[nobottomtitles*]{titlesec} 有替代品吗?

\usepackage[nobottomtitles*]{titlesec} 有替代品吗?

\usepackage[nobottomtitles*]{titlesec}有没有其他选择我的自动清除floatingfingure

\documentclass{article}
\usepackage{mwe}

\makeatletter
\def\maxwidth{\ifdim\Gin@nat@width>\linewidth\linewidth
\else\Gin@nat@width\fi}
\makeatother
\let\Oldincludegraphics\includegraphics
\renewcommand{\includegraphics}[1]{\Oldincludegraphics[width=\maxwidth]{#1}}

\setlength{\parindent}{0pt}

% begin preamble.tex
\usepackage[nobottomtitles*]{titlesec}
%\renewcommand{\bottomtitlespace}{.2\textheight}

\usepackage{calc}
\newlength\vimgflt
\newlength\vposflt
\newlength\vtypesetflt
\newlength\vspaceflt

\usepackage{floatflt}
\renewenvironment{description}{%
    \renewcommand{\includegraphics}[1]{\vspace{-1ex}\Oldincludegraphics[width=4cm]{##1}}
    \renewcommand{\item}[1][]{
        \settototalheight\vimgflt{##1}%
        \global\vimgflt=\vimgflt%
        ##1%
        \end{floatingfigure}%
        \setlength\vposflt\pagetotal%
        \global\vposflt=\vposflt%
        }%
    \clearflt
    \hspace{0pt}%
    \begin{floatingfigure}[l]{4cm}}%
    {}

\newcommand{\clearflt}{
    \par%
    \setlength\vtypesetflt{\dimexpr\pagetotal-\vposflt}
    \ifdim \vtypesetflt<\vimgflt \setlength\vspaceflt{\dimexpr\vimgflt-\vtypesetflt+\baselineskip} \else \setlength\vspaceflt{0pt} \fi
    \vspace*{\vspaceflt}
    }

\let\Oldsection\section
\renewcommand{\section}{\clearflt\Oldsection}
% end preamble.tex

\begin{document}
\blindtext
\section{Section title}
\begin{description}
\itemsep1pt\parskip0pt\parsep0pt
\item[\includegraphics{example-image-a}]
Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Etiam lobortis facilisis
sem. Nullam nec mi et neque pharetra sollicitudin.
\end{description}

\section{Section title}
\begin{description}
\itemsep1pt\parskip0pt\parsep0pt
\item[\includegraphics{example-image-b}]
Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Etiam lobortis facilisis
sem. Nullam nec mi et neque pharetra sollicitudin.
\end{description}

\section{Section title}
\begin{description}
\itemsep1pt\parskip0pt\parsep0pt
\item[\includegraphics{example-image-c}]
Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Etiam lobortis facilisis
sem. Nullam nec mi et neque pharetra sollicitudin.
\end{description}

\blindtext[2]
\end{document}

\usepackage[nobottomtitles*]{titlesec} 混乱

相关内容