Text FormattingItemize flushed to bottom when using \vfill

Information and discussion about LaTeX's general text formatting features (e.g. bold, italic, enumerations, ...)
Post Reply
fsoedjede
Posts: 3
Joined: Sat Jun 25, 2022 11:12 pm

Itemize flushed to bottom when using \vfill

Post by fsoedjede »

Hello everyone,

I have an use as stated in the subject.
I can't find why it's occurring.

The first section is ok but in the second, the itemize is flushed to the bottom of the page

I'm using `pdfTeX 3.141592653-2.6-1.40.24 (TeX Live 2022)`

Thanks for your help

Here is my code

Edit: I changed the formatting to make the code testable directly

Code: Select all

\PassOptionsToPackage{unicode=true}{hyperref} % options for packages loaded elsewhere
\PassOptionsToPackage{hyphens}{url}

\documentclass[12pt,twoside,openright,a5paper]{book}
\usepackage{draftwatermark}
\SetWatermarkLightness{0.8}

\usepackage{lipsum}
\usepackage{parskip}
\usepackage{enumitem}
\usepackage[bottom=1.25cm,left=1cm,right=1.5cm,top=2.5cm,nomarginpar]{geometry}

\newenvironment{thought}{\newpage\setlength{\parindent}{0pt}}{}

\ifx\subparagraph\undefined\else
\let\oldsubparagraph\subparagraph
\renewcommand{\subparagraph}[1]{\oldsubparagraph{#1}\mbox{}}
\fi

% Remove titles counter
\renewcommand{\thesection}{}
\renewcommand{\theparagraph}{}
\renewcommand{\thesubparagraph}{}

\begin{document}

    \begin{thought}

        \section{Example 1 - seems ok}

        \bigskip
        \vfill

        \lipsum[1]

        To study one's family, ask:

        \begin{itemize}
            \item Phasellus sit amet sem et lorem ultricies tincidunt.
            \item Suspendisse id nisi vulputate velit auctor mattis.
            \item Sed dignissim elit at nunc placerat, vitae efficitur lorem viverra.
            \item Sed luctus tortor non libero ultricies luctus.
            \item Ut semper velit vel augue feugiat iaculis.
            \item Vivamus ullamcorper erat dignissim tortor luctus fringilla.
            \item Suspendisse quis odio tincidunt neque faucibus auctor.
            \item Nunc posuere elit non fringilla sagittis.
            \item Aliquam at arcu non purus rutrum suscipit.
            \item Donec laoreet justo sit amet mi laoreet auctor.
            \item Pellentesque vehicula lorem tincidunt sem consectetur tincidunt.
        \end{itemize}

         \lipsum[3][1-3]

        \begin{itemize}
            \item Lorem ipsum dolor sit amet, consectetur adipiscing elit.
            \item Sed ultricies nunc non felis blandit imperdiet.
        \end{itemize}

        Vitae tortor condimentum lacinia quis. Sagittis eu volutpat odio facilisis mauris.
        Arcu cursus vitae congue mauris rhoncus aenean vel elit.
        Nibh nisl condimentum id venenatis a condimentum vitae sapien.
        Libero justo laoreet sit amet\ldots.

        \vfill
        \bigskip

        \subparagraph{Yaounde, 1 April 2008}

    \end{thought}

    \begin{thought}

        \section{Example 1 - seems ko}

        \bigskip
        \vfill

        You cannot be great if you say: ``If I don't do it, others will do it.''

        The thought, ``This particular contribution from me is absolutely
        indispensable for the total success of the work;'' is part of having a
        sense of destiny.

        What makes people succeed:

        \begin{itemize}
            \item Curabitur venenatis nunc in odio scelerisque facilisis.
            \item Donec vel ipsum porttitor elit feugiat tincidunt et non turpis.
            \item Ut maximus odio non aliquam cursus.
            \item Donec sed enim hendrerit diam mattis finibus.
            \item Etiam sed nisl venenatis, egestas ante quis, elementum lorem.
        \end{itemize}

        \lipsum[1]

        \lipsum[2]

        \lipsum[3]

        \vfill
        \bigskip

        \subparagraph{Yaounde, 10 April 1990}

    \end{thought}

\end{document}
Attachments
vfill-itemize-test.tex
My code
(3.16 KiB) Downloaded 160 times

Recommended reading 2024:

LaTeXguide.org • LaTeX-Cookbook.net • TikZ.org

NEW: TikZ book now 40% off at Amazon.com for a short time.

User avatar
Stefan Kottwitz
Site Admin
Posts: 10321
Joined: Mon Mar 10, 2008 9:44 pm

Itemize flushed to bottom when using \vfill

Post by Stefan Kottwitz »

Hi,

welcome to the forum! And very good that you made your code testable! So we can see the issue right here in the forum without downloading code and testing with a local LaTeX compiler.

In the second example, the second \vfill comes after the page break, so the first \vfill pushes the itemize down but there's no \vfill on the same page that pushes up. If you don't have the 3 lipsums but just \lipsum[2]\vfill, you will see that itemize doesn't go down.

Stefan
LaTeX.org admin
fsoedjede
Posts: 3
Joined: Sat Jun 25, 2022 11:12 pm

Itemize flushed to bottom when using \vfill

Post by fsoedjede »

Thanks for your reply @Stephan,

I need that \vfill so I can't remove it.
The first example in the document seems not working when I tested more.

Let me explain what problematic I want to solve.

I want to format part of my document having
1. \section - must always be at the top of a new page
2. A content
when it's short, it must be centered in the page.
If it's long as is on multiple page, there must be a some vspace at top et bottom of the content. That's why I use \bigskip before the \vfill.
3. \subparagraph - must always be at the bottom of the page it's on

When the content does not contains \begin{itemize}, everything works fine
When the content contains \begin{itemize}, and all will fit in one page, everything works fine
When the content contains \begin{itemize}, the list is flushed at the bottom of the page.

That's my issue.

I don't have full control on the b]content[/b] so I cannot decide when to add the \vfill or not.

I'm open to a change in the structure of the document if need.

Thanks for anyone who can help
Kreuz Elf
Posts: 22
Joined: Thu Mar 04, 2021 7:33 pm

Itemize flushed to bottom when using \vfill

Post by Kreuz Elf »

Please don't ask me why that works, I found it on a stackexchange site from 2011.
You could try adding \hspace{0pt} commands before the first and after the second \vfill command like this:

Code: Select all

\documentclass[ngerman,a4paper]{scrartcl}
\usepackage[T1]{fontenc}
\usepackage[utf8]{inputenc}
\usepackage[ngerman]{babel}

\usepackage{blindtext}

\begin{document}
	\hspace{0pt}
	\section{Example Section}
	\vfill
	\blindtext
	\vfill
	\hspace{0pt}
\end{document}
AFAIK your number 1 complain should be the default in most document classes.
Post Reply