Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 783037
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 14, 20262026-05-14T20:28:57+00:00 2026-05-14T20:28:57+00:00

I am using the exercise package to display exercises in a book. I have

  • 0

I am using the exercise package to display exercises in a book. I have redefined some commands like this, which basically adds some space, a pencil, and two hrule’s before and after the exercise:

\renewcommand{\ExerciseHeader}{\vskip 1em\hrule\vskip 1em\centerline{\textbf{\large\smallpencil
\ExerciseHeaderNB\ExerciseHeaderTitle%
\ExerciseHeaderDifficulty\ExerciseHeaderOrigin\medskip}}}
\makeatletter\def\endExerciseEnv{\termineliste{1}\@EndExeBox\vskip .5em\hrule\vskip 1em}\makeatother

Now this works, but there’s a small problem:

There are situations where only the \hrule ends up being at the bottom of a page, and the rest of the exercise goes on the next page. There is also the opposite behavior: the entire exercise is on one page, except the \hrule in “endExerciseEnv”, which is flushed to the next page.

How do I force the top hrule come?

  • either together with the header of the exercise (caption, title, whatever not) and at least say 5em or so of “exercise text” (so it doesn’t look ugly),
  • OR be flushed altogether, with the entire exercise?

A similar question for the bottom hrule:

How do I force it have at least 5 em of “exercise text” in front of it on the visible page where the hrule itself goes to? (or the beginning of the Exercise environment, whichever comes first – as it’s the case if the environment is not higher than 5em)

Addendum

I have asked in the past LaTeX questions like this and I’ve got answers which required me to do stuff manually, like “insert a \vskip here and there” or such.

Let me be clear: This is a book, there are a lot of exercises, and I need it be done “automatically”, by going the proper way of redeclaring commands & co.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-14T20:28:58+00:00Added an answer on May 14, 2026 at 8:28 pm

    TeX can insert page break before any glue, for example \vskip 1em.

    Make some changes:

    1) You write \vskip 1em\hrule\vskip 1em
    Replace it with

    \vskip 1em\hrule \nobreak \vskip 1em
    

    2) You write \vskip .5em\hrule\vskip 1em
    Replace it with

    \nobreak\vskip .5em\hrule\vskip 1em
    

    You also can insert \goodbreak to show good point to break the page.
    This good point can be inserted before and after your excersise.

    1) \goodbreak\vskip 1em\hrule \nobreak \vskip 1em

    2) \nobreak\vskip .5em\hrule \goodbreak \vskip 1em

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have to solve an exercise using awk. Basically I need to retrieve from
I'm working through a JPanel exercise in a Java book. I'm tasked with creating
I have very little experience with ASP.NET and I am doing some self-training before
While working through Real World Haskell, I tried to complete the palindrome exercise using
I'm doing exercise #9 from http://openbookproject.net/thinkcs/python/english2e/ch09.html and have ran into something that doesn't make
I recently set up, for a learning exercise, an Ubuntu desktop PC with KDE
While I'm working on it, I have my application's location hardcoded: public static string
As part of learning WPF I just finished working through an MS Lab Exercise
I wanted to learn how to create python packages, so I visited http://docs.python.org/distutils/index.html .

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.