1

In Lyx beamer environment, enumerate is not compiling properly: the balls overlay the first letters of the item text, and the numbers are to the left of the balls (and invisible because they're white on white--confirmed by changing color). This does not occur when my preamble only contains \usetheme{Madrid} but it does occur when I add the code I have found to reduce space between displayed equations. I am not aware of any other way to globally reduce space between displayed equations.

Any tips would be greatly appreciated.

Problem slide

Here is the code from my Lyx document that generates this image:

#LyX 2.0 created this file.
\lyxformat 413
\begin_document
\begin_header
\textclass beamer
\begin_preamble
\usetheme{Madrid}

% Code to reduce space between displayed equations
\g@addto@macro\normalsize{%
  \setlength\abovedisplayskip{2pt}
  \setlength\belowdisplayskip{2pt}
  \setlength\abovedisplayshortskip{2pt}
  \setlength\belowdisplayshortskip{2pt}
}

\end_preamble

\use_default_options true
\maintain_unincluded_children false
\language english
\language_package default
\inputencoding auto
\fontencoding global
\font_roman default
\font_sans default
\font_typewriter default
\font_default_family default
\use_non_tex_fonts false
\font_sc false
\font_osf false
\font_sf_scale 100
\font_tt_scale 100

\graphics default
\default_output_format default
\output_sync 0
\bibtex_command default
\index_command default
\paperfontsize default
\spacing single
\use_hyperref false
\papersize default
\use_geometry true
\use_amsmath 1
\use_esint 1
\use_mhchem 1
\use_mathdots 1
\cite_engine basic
\use_bibtopic false
\use_indices false
\paperorientation portrait
\suppress_date false
\use_refstyle 1
\index Index
\shortcut idx
\color #008000
\end_index
\secnumdepth 3
\tocdepth 3
\paragraph_separation indent
\paragraph_indentation default
\quotes_language english
\papercolumns 1
\papersides 1
\paperpagestyle default
\tracking_changes false
\output_changes false
\html_math_output 0
\html_css_as_file 0
\html_be_strict false
\end_header

\begin_body

\begin_layout BeginFrame
Testing
\end_layout

\begin_layout Enumerate
Elephant
\end_layout

\begin_layout Enumerate
Zebra
\end_layout

\begin_layout Enumerate
Jaguar
\end_layout

\begin_layout Standard
Want less space between display equations
\begin_inset Formula 
\[
y=a+bx
\]

\end_inset


\end_layout

\begin_layout Standard
and
\end_layout

\begin_layout Standard
\begin_inset Formula 
\[
z=d+rw
\]

\end_inset


\end_layout

\begin_layout Standard
ending here.
\end_layout

\begin_layout EndFrame

\end_layout

\end_body
\end_document
  • As with all lyx questions (in my point of view): The internal (hidden) settings are quite difficult to interprete if no example is given –  Apr 06 '15 at 20:00
  • Sorry, can you be more specific? I don't know what you mean by "example." Example of what? – user43953 Apr 06 '15 at 20:04
  • @user43953 http://wiki.lyx.org/FAQ/MinimalExample – scottkosty Apr 07 '15 at 04:13
  • @user43953 Note that .lyx files are just text files. You can open them with a text editor, copy the text, and paste it in here. Please read the information on the link above. – scottkosty Apr 07 '15 at 04:13
  • Ok thank you for advice, I revised the post. Let me know if this is still not the right way to post. – user43953 Apr 07 '15 at 13:16
  • Please indent the code by 4 spaces, or highlight it and press the '{}' button: it will be more readable. – Astrinus Apr 07 '15 at 13:21
  • 1
    @user43953 thanks for the example. I can now reproduce. You should also produce a minimal example .tex file (in LyX go to File > Export) and post that here. There are many people here who do not use LyX, and this really comes down to a LaTeX question (because you are using preamble code). – scottkosty Apr 09 '15 at 05:33

1 Answers1

1

This occurs in an equivalent ordinary LaTeX document that includes your space reducing code:

Sample output

\documentclass{beamer}

\usetheme{Madrid}

\makeatletter
\g@addto@macro\normalsize{%
  \setlength\abovedisplayskip{2pt}
  \setlength\belowdisplayskip{2pt}
  \setlength\abovedisplayshortskip{2pt}
  \setlength\belowdisplayshortskip{2pt}
}
\makeatother

\begin{document}
\begin{frame}
\frametitle{Testing}

  \begin{enumerate}
  \item Elephant
  \item Zebra
  \item Jaguar
  \end{enumerate}

  Want less space between display equations
  \[
    y=a+bx
  \]
  and
  \[
    z=d+rw
  \]
  ending here.
\end{frame}

\end{document}

The bad placement is an artefact of spurious spaces at the ends of lines in your \g@addto@macro. You should comment out each end of line as follows:

\makeatletter
\g@addto@macro\normalsize{%
  \setlength\abovedisplayskip{2pt}%
  \setlength\belowdisplayskip{2pt}%
  \setlength\abovedisplayshortskip{2pt}%
  \setlength\belowdisplayshortskip{2pt}%
}
\makeatother

This then fixes your output:

Corrected output

\documentclass{beamer}

\usetheme{Madrid}

\makeatletter
\g@addto@macro\normalsize{%
  \setlength\abovedisplayskip{2pt}%
  \setlength\belowdisplayskip{2pt}%
  \setlength\abovedisplayshortskip{2pt}%
  \setlength\belowdisplayshortskip{2pt}%
}
\makeatother

\begin{document}
\begin{frame}
\frametitle{Testing}

  \begin{enumerate}
  \item Elephant
  \item Zebra
  \item Jaguar
  \end{enumerate}

  Want less space between display equations
  \[
    y=a+bx
  \]
  and
  \[
    z=d+rw
  \]
  ending here.
\end{frame}

\end{document}

Without the comment characters, each call to \normalsize inserts four spaces (one for each newline). As the bullet item calls \normalsize there is space inserted before the labels moving them right, and consequently making them overlap the item text.

See What is the use of percent signs (%) at the end of lines? for a discussion of percent characters at the end of lines.

Andrew Swann
  • 95,762