Take the 2-minute tour ×
TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.
 \begin{mdframed}[backgroundcolor=green]     
 \textbf{Theorem:}     
 \begin{center} A set $E$ is {\bf open} $\iff E^c$ is {\bf closed} \end{center}      
 \centerline{or equivalently,} 
 \centerline{A set $E$ is {\bf open} $\iff E^c$ is {\bf closed} }
\end{mdframed}

So basically I want to get Theorem to align on the same line as \begin{center} A set $E$ is {\bf open} $\iff E^c$ is {\bf closed} \end{center} without producing another new line. Adding flushleft inside the center environment has no effect.

share|improve this question
    
    
you can easily use minipage inside mdframed environment –  smh Dec 25 '12 at 1:08

1 Answer 1

up vote 5 down vote accepted

Try using only center and then some box-control (via \phantom) for the first line:

enter image description here

\documentclass{article}
\usepackage{xcolor,mdframed}% http://ctan.org/pkg/{xcolor,mdframed}
\begin{document}
% Original layout/use
\begin{mdframed}[backgroundcolor=green]
  \textbf{Theorem:}
  \begin{center} A set $E$ is {\bf open} $\iff E^c$ is {\bf closed} \end{center}
  \centerline{or equivalently,}
  \centerline{A set $E$ is {\bf open} $\iff E^c$ is {\bf closed} }
\end{mdframed}

\bigskip

% Updated layout/use
\begin{mdframed}[backgroundcolor=green]
\begin{center}
  \textbf{Theorem:} \hfill A set~$E$ is \textbf{open} $\iff E^c$ is \textbf{closed} \hfill \phantom{\textbf{Theorem:}} \\
  or equivalently, \\
  A set~$E$ is \textbf{open} $\iff E^c$ is \textbf{closed}
\end{center}
\end{mdframed}

\end{document}

The first line is set at full width using a displayed Theorem: on the left, and a \phantom Theorem: on the right.

share|improve this answer
    
Say I want to make some space in between each line (vertical space), how would I accomplish this? seperating the centers and adding \\ didn't work –  Hawk Dec 25 '12 at 1:15
    
@jak: Use \\[<len>] where you specify <len>. For example, \\[\jot] inserts a 3pt gap, \\[\baselineskip] inserts a empty line. –  Werner Dec 25 '12 at 4:46

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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