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.

I'm trying to create an environment able to understand when it's on a single/two columns layout and to span over multiple pages or columns having different style for the two cases. I would want to obtain something like this example:

http://dl.dropbox.com/u/9439473/share/target.pdf

I tried framed and mdframed package but they seem not to be quite configurable for my needs and seem to have problems with 2-columns layout. Can you advise me a quite configurable package which can do what i need (see the attachment) or if not, is there a command which i can use to understand when i reached the end of page or column?

To solve my problem I'm trying to use TikZ nodes to create the frame, and i would understand when it's time to go on the next page/column to create a new node and put there the following text, but i don't know how to create the partially dashed line on corners, and how to detect the end of page or column. Any suggestion?

share|improve this question
    
Mmm, see my answer to Test if a paragraph has a page break in it? which is somehow similar to what you want. It could be used to create some style like the one in your example file. –  Martin Scharrer Jul 2 '11 at 15:34
add comment

1 Answer

It is also possible to raise the lines with package xhfill

\documentclass{article}
\usepackage[english]{babel}
\usepackage{blindtext}

\usepackage{mdframed,xcolor}
\newcounter{example}
\newenvironment{example}
  {\begin{mdframed}[linewidth=2,
      backgroundcolor=black!15,
      skipbelow=\baselineskip,
      skipabove=\baselineskip]
    \refstepcounter{example}
    \hrulefill~Example~\theexample~\hrulefill\par}
  {\par\noindent\hrulefill\par\end{mdframed}}

\begin{document}
\blindtext
\begin{example}
\blindtext
\end{example}
\blindtext

\end{document}

enter image description here

share|improve this answer
add comment

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.