3

The following code gives me as reference the section and not the signpost. It is probably a beginner's mistake.

\documentclass{article}

\usepackage{tikz}
\usepackage{mdframed}


\newcounter{signpost}%
\newenvironment{signpost}[1][]{%
    \stepcounter{signpost}%
        \ifstrempty{#1}%
        {\mdfsetup{%
            frametitle={%
                \tikz[baseline=(current bounding box.east),outer sep=0pt]
                \node[anchor=east,rectangle,fill=blue!20]
                {\strut Summary~\thesignpost};}}
        }%
        {\mdfsetup{%
            frametitle={%
                \tikz[baseline=(current bounding box.east),outer sep=0pt]
                \node[anchor=east,rectangle,fill=blue!20]
                {\strut Summary~\thesignpost:~#1};}}%
        }%
        \mdfsetup{innertopmargin=10pt,linecolor=blue!20,%
            linewidth=2pt,topline=true,
            skipabove=6pt, skipbelow=6pt, nobreak=true,
            frametitleaboveskip=\dimexpr-\ht\strutbox\relax,}
        \begin{mdframed}[]\relax%
        }{\end{mdframed}}

\usepackage[noabbrev]{cleveref}
\crefname{signpost}{summary}{summaries} 



\begin{document}

\section{Hello Stackexchange}

This is some text.

\begin{signpost}[This is a summary]
This is a summary of the above text.
\label{signpost:MWE}
\end{signpost}

In \cref{signpost:MWE} you see \ldots

\end{document}

What do I need to change in order to get the "In signpost 1 you see..."

2

You just have to change \stepcounter{signpost} to \refstepcounter{signpost}. The latter makes your signpost counter the one used by the reference mechanism.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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