Tell me more ×
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.

When nesting frames the inner most frametitle is used. The frametitle for all these is frame3.

\documentclass{book} 
\usepackage{mdframed}
\begin{document}
\begin{mdframed}[frametitle={frame1}]
asdf
    \begin{mdframed}[frametitle={frame2}]
    134
        \begin{mdframed}[ frametitle={frame3}]
            asdf1324
        \end{mdframed}
    \end{mdframed}
\end{mdframed}
\end{document}

(mdframed v1.4)

share|improve this question
First time I see such a using. ;-). Note that this can't be splitted well. – Marco Daniel Mar 21 '12 at 10:31
Not sure what you mean that it can't be splitted well? Everything seems to work but the title(may not be perfect but works for what I'm trying to do). I suppose basically whatever function is not "reentrant" in that it uses a "global variable" for the frame title. What happens is the inner frame ends up overwriting the outer frame which is displayed after(for some reason, possibly to get the size right) the content of the frame. Should be an easy fix by just putting the title in a "local variable". – Uiy Mar 21 '12 at 11:54

1 Answer

up vote 8 down vote accepted

EDIT: I uploaded a new test version to github. Please check it out.

https://github.com/marcodaniel/mdframed

enter image description here


With the current version you can't change this behavior. To assign the frame title I am using a group and the contents is saved in a box. To get a global access to the box I need the command \global. So in your case I overwrite the last frame title.

I will think about this request and maybe I will change the implementation.

This is the best answer I can provide so far

share|improve this answer
In some other questions I had several answers that used a global stack. Maybe you can use the interpretations it as a quick and easy solution? (simply push the title on the "stack" on each nesting then pop them when ready to use) – Uiy Apr 14 '12 at 23:02
@Uiy: Do you have a link? – Marco Daniel Apr 14 '12 at 23:02
tex.stackexchange.com/questions/51070/… My guess is, any time you use the title text, just convert to using the stack... need to push it at the start of the environment and then pop it and use it right when it is displayed... this should reduce all issues unless you have to deal with measuring issues in which case you might try poping it and using it right before the geometrical calculations. – Uiy Apr 14 '12 at 23:17
1  
@Uiy: I remember this question. I will think about this tomorrow. – Marco Daniel Apr 14 '12 at 23:25
@Uiy: Please see my update. – Marco Daniel Apr 27 '12 at 23:14
show 2 more comments

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.