Skip to content

Instantly share code, notes, and snippets.

@MarkusH
Created February 24, 2015 19:10
Show Gist options
  • Save MarkusH/f037f44f60fc78bef98a to your computer and use it in GitHub Desktop.
Save MarkusH/f037f44f60fc78bef98a to your computer and use it in GitHub Desktop.
Referencing custom environments with custom counters
\newcounter{mycounter}
\newenvironment{myenv}[2][]{
\begin{adjustwidth}{30pt}{30pt}\widowpenalties 1 10000
\refstepcounter{mycounter}
\begingroup
\GetTitleStringSetup{expand}%
\subsubsection*{Foo~\arabic{mycounter}: {#2}}%
\ifthenelse{\equal{#1}{}}{}{\label{foo:#1}}\vspace{-7.5pt}
\endgroup
\noindent\ignorespaces}{
\end{adjustwidth}}
\newcommand{\myenvref}[1]{\emph{\nameref{foo:#1}}}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment