Great forum here, I am a newb so bear with me. I am trying to figure out how to add a horizontal rule before and after the example environment (in the book (AMS) class). So ideally it would look something like
--------------------------
Example 1.1
blah blah
blah blah
--------------------------
I have figured that I could probably use the preamble to modify the environment, but after that I don't know what would need to be done to get it to work. Can anyone give a suggestion?
LyX ⇒ Editing example environment
NEW: TikZ book now 40% off at Amazon.com for a short time.
Editing example environment
I'd probably just define a custom environment using \newenvironment that added a call to \hrulefill (or \noindent\hrulefill) both before and after a call to the regular definition environment. E.g.:
Someone else might know of a better solution.
Code: Select all
\documentclass{amsbook}
\usepackage{lipsum} % for autogenerating sample text
\theoremstyle{definition}
\newtheorem{defn}{Definition}[chapter]
\newenvironment{ruleddef}{\noindent\hrulefill\begin{defn}}{\end{defn}\noindent\hrulefill}
\begin{document}
\chapter{A chapter}
\lipsum[11-13]
\begin{ruleddef}
My first definition.
\end{ruleddef}
\lipsum[6-8]
\begin{ruleddef}
My second definition
\end{ruleddef}
\lipsum[1-3]
\end{document}
Editing example environment
I think I know what you are saying. Define a new environment that just wraps another environment inside the hrule's? I tried that by just blindly modifying what you wrote and pasting only
into the preamble. I can't find a new environment in the drop down list. obviously, I am inexperienced in the concept for this type of thing.
A huge thanks for a response!
Code: Select all
\singlerule{ruleddef}{\noindent\hrulefill\begin{defn}}{\end{defn}\noindent\hrulefill}
A huge thanks for a response!
Re: Editing example environment
Sorry, I didn't realize this was in the LyX subforum. My answer was assuming that you were using coding LaTeX directly. I don't know anything about LyX. Maybe someone else can help.
Editing example environment
No problem. I have done some more hunting about this and have found out that the machinery that is doing all of this nice formatting is an .inc file. It sets the styles and all that. I am not sure how they all work but I'll try to test some stuff out. I really would just like to have lyx automatically throw in some lyx code before and after the example, something like this ...
Anyone?
Code: Select all
\vspace{1pt}
\hrule
\vspace{15pt}
-
- Posts: 8
- Joined: Fri Dec 04, 2009 1:50 pm
Editing example environment
Can't you just
insert -> formatting -> horizontal line
or
insert -> formatting -> horizontal space -> horizontal fill
then place the example between the two lines?
insert -> formatting -> horizontal line
or
insert -> formatting -> horizontal space -> horizontal fill
then place the example between the two lines?