Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

mdframed theorem environments + \listoftheorems #1

Closed
andrew-hill opened this issue Apr 11, 2012 · 5 comments
Closed

mdframed theorem environments + \listoftheorems #1

andrew-hill opened this issue Apr 11, 2012 · 5 comments
Assignees

Comments

@andrew-hill
Copy link

I'm using mdframed + theorems as per Example 5 in mdframed-example-default.pdf but can't figure out how to generate a list of theorems.

I define my environment as follows

\mdfdefinestyle{examplestyle}{linewidth=2pt,innermargin=1em,outermargin=1em,%
                       skipabove=1em,skipbelow=1em,backgroundcolor=examplebackground,%
                       needspace=8cm%
}
\mdtheorem[style=examplestyle]{example}{Example}[chapter]

Then use it as

\begin{example}[Some trivial example]
        \dots
\end{example}

Previously I had been using the thmtools package and defining my theorem with \newtheoremstyle & \declaretheorem (and making my own environment that called mdframed around the theorem env), which seems to handle some of the registration for \listoftheorems, but when I use the method suggested in the mdframed example document, I get an empty \listoftheorems.

Is there some trick to having mdframed theorems registered in the \listoftheorems?

@andrew-hill
Copy link
Author

On a side note, for what it's worth, I'm really impressed by how far mdframed has come since I last used it (over a year ago) when you sent me v0.5 for testing. It's definitely easier to use with theorems, and I really like the look of some of your more advanced examples; I'll definitely be trying those out (:

@ghost ghost assigned marcodaniel Apr 12, 2012
@marcodaniel
Copy link
Owner

Hi,

mdframed uses the command \newtheorem to create a theorem environment. If you use the package thmtools or ntheorem you can use \listtheorems.

Marco

@andrew-hill
Copy link
Author

mdframed seems to call \newtheorem for \newmdtheoremenv, but does not for \mdtheorem — so the list only seems to work for \newmdtheoremenv environments, not \mdtheorem environments — is that intentional?

@marcodaniel
Copy link
Owner

Hi,

sorry I complety missed this. I uploaded a new version (github). With the new version the following example should work well. Note I didn't support the unnumbered star-version.

\documentclass{article}
\usepackage{xcolor}
\usepackage{amsmath}
\usepackage{ntheorem}
\usepackage{mdframed}
\mdtheorem{lemma}{Lemma}
\newrobustcmd\ExampleText{%
An \textit{inhomogeneous linear} differential equation has the form
\begin{align}
L[v ] = f,
\end{align}
where $L$ is a linear differential operator, $v$ is
the dependent variable, and $f$ is a given non−zero
function of the independent variables alone.
}
\begin{document}
\listtheorems{lemma}
\section{foo}
\begin{lemma}[inhomogeneous linear]
\ExampleText
\end{lemma}
\begin{lemma}[inhomogeneous linear]
\ExampleText
\end{lemma}
\end{document} 

@egeerardyn
Copy link

I have the impression that including mdtheorems in a \listoftheorems still does not work. I cross-posted this to TeX.SE, but I repeat the code and output here for convenience:

\documentclass{article}
\usepackage{amsthm,thmtools}
\usepackage{mdframed}
\usepackage{xcolor}

\usepackage{mdframed}
\mdfdefinestyle{guidelinestyle}{% 
  linecolor=black,
  linewidth=1pt,
  frametitlerule=true,
  frametitlefont=\sffamily\bfseries,
  frametitlebackgroundcolor=gray!20,
  innertopmargin=\topskip,
} 
% \newmdenv[style=guidelinestyle]{asEnv}{asEnv}[section]
\newmdtheoremenv[style=guidelinestyle]{asTheoremEnv}{asTheoremEnv}[section]
\mdtheorem[style=guidelinestyle]{asTheorem}{asTheorem}[section]

\begin{document}
\expandafter\csname ver@mdframed.sty\endcsname

%\listoftheorems[ignoreall,show=xxx]  % this is how I actually display it in my document
\listoftheorems

\section{My section}

% \begin{asEnv}[As environment, it appears in ToTh]
%   But it doesn't look like what I want.
% \end{asEnv}

\begin{asTheoremEnv}[As theoremEnv, it appears in ToTh]
  But it doesn't look like what I want.
\end{asTheoremEnv}

\begin{asTheorem}[As theorem, it does not appear in ToTh]
 But it looks a lot better!
\end{asTheorem}

\end{document}

MWE

As you see, the version included in TeX Live (MacTeX 2015), this issue still exists: the mdtheorem is not included in the table of theorems, the other one is (but doesn't look the same).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants