3

In LyX, how would I globally adjust the space between examples, theorems, etc.?

enter image description here

Is there some relatively short command I can add to my preamble?

Image above taken from PDF generated by LyX file, converted into the following LaTeX (plain):

%% LyX 2.2.3 created this file.  For more info, see http://www.lyx.org/.
%% Do not edit unless you really know what you are doing.
\documentclass[english]{article}
\usepackage[T1]{fontenc}
\usepackage[latin9]{inputenc}
\setlength{\parskip}{\bigskipamount}
\setlength{\parindent}{0pt}
\usepackage{amsmath}
\usepackage{amsthm}

\makeatletter
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% Textclass specific LaTeX commands.
\theoremstyle{plain}
\newtheorem{thm}{\protect\theoremname}
  \theoremstyle{definition}
  \newtheorem{example}[thm]{\protect\examplename}

\makeatother

\usepackage{babel}
  \providecommand{\examplename}{Example}
\providecommand{\theoremname}{Theorem}

\begin{document}
\begin{example}
Hello.
\end{example}

\begin{example}
Hello.
\end{example}

\begin{thm}
Hello.
\end{thm}

\begin{thm}
Hello.
\end{thm}


\end{document}
2

Other than redefining the theorem styles, with thmtools for instance you can change the value of \topsep. Such a modification seem to change its value only for theorem-like structures, but I didn't test thoroughly. So I suggest this small addition to your code (value to be adjusted to your needs – I exaggerated the modification for demonstration purposes):

\documentclass[english]{article}
\usepackage[T1]{fontenc}
\usepackage[latin9]{inputenc}
\setlength{\parskip}{\bigskipamount}
\setlength{\parindent}{0pt}
\usepackage{amsmath}
\usepackage{amsthm}

\makeatletter
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% Textclass specific LaTeX commands.
\theoremstyle{plain}
\newtheorem{thm}{\protect\theoremname}
  \theoremstyle{definition}
  \newtheorem{example}[thm]{\protect\examplename}
\topsep = 1cm
\makeatother
\usepackage{babel}
\providecommand{\examplename}{Example}
\providecommand{\theoremname}{Theorem}

\begin{document}

\begin{example}
Hello.
\end{example}

\begin{example}
Hello.
\end{example}

\begin{thm}
Hello.
\end{thm}

\begin{thm}
Hello.
\end{thm}

\end{document} 

enter image description here

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.