Text FormattingVertical space, newtheorem and list

Information and discussion about LaTeX's general text formatting features (e.g. bold, italic, enumerations, ...)
Post Reply
petey
Posts: 10
Joined: Sat Feb 27, 2010 9:23 pm

Vertical space, newtheorem and list

Post by petey »

Hi,

I have created a new environment called "example" using \newtheorem.

My problems is when i write something like this

Code: Select all

\begin{example}[Title of example]
\begin{enumerate}
\item This is a test
\end{enumerate
\end{example}
then the "This is a test" item will float to the "title of example". It looks something like this:
Title of example 1) This is a test
If I write some text before I begin enumerating then there is no problem.

How can I add som vertical space? I have tried with \vspace but no luck.

Thanks in advance.
Petey

Recommended reading 2024:

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

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

And: Currently, Packt sells ebooks for $4.99 each if you buy 5 of their over 1000 ebooks. If you choose only a single one, $9.99. How about combining 3 LaTeX books with Python, gnuplot, mathplotlib, Matlab, ChatGPT or other AI books? Epub and PDF. Bundle (3 books, add more for higher discount): https://packt.link/MDH5p

NoIdeaNickanme
Posts: 13
Joined: Wed Nov 09, 2011 5:41 pm

Vertical space, newtheorem and list

Post by NoIdeaNickanme »

Did you try inserting a proper caption? e.g.:

Code: Select all

\begin{example}
  \caption[Title of example for TOC]{Title of example}
       \begin{enumerate} 
       \item This is a test
       \end{enumerate}
\end{example}
You may need to add into your preamble (under the newfloat commands)

Code: Select all

\floatname{example}{Example} 

which defines the caption title displayed before your caption. In this case, the result is: Example 1: Title of Example

The alternative would be to just force in an empty line like:

Code: Select all

\textnormal{ }\\
before the enumerate float and then fix the spacing using \vspace
Post Reply