# Using autoref with my own label to my own new environment [closed]

I defined my own environment. Now I want to refer to my environment with autoref. But autoref should refer with my own defined name. But I don't know how to do this. Could someone help me?

My code looks like this:

\documentclass[a4paper,12pt]{scrreprt}
\usepackage[latin1]{inputenc}
\usepackage[ngerman]{babel}
\usepackage[framemethod=tikz]{mdframed} %Boxen mit Seitenumbruch
\usepackage{tikz}
\usepackage{hyperref}
%
%
%
%
%
%
\begin{document}
\section{Section1}
\begin{mybox}{TestBOX}\label{lablel1}
TEST
\end{mybox}

\section{Section1}
Test
\autoref{lablel1}

\end{document}

-

## closed as too localized by Marco Daniel, lockstep, Thorsten, Stefan Kottwitz♦Apr 20 '13 at 7:21

This question is unlikely to help any future visitors; it is only relevant to a small geographic area, a specific moment in time, or an extraordinarily narrow situation that is not generally applicable to the worldwide audience of the internet. For help making this question more broadly applicable, visit the help center.If this question can be reworded to fit the rules in the help center, please edit the question.

Welcome to TeX.sx! Your environment has no anchor for any labels. What do you want to achieve? –  Marco Daniel Apr 12 '13 at 12:22
When I now use \autoref, then comes something like "Section 0.1" (or in German "Abschnitt0.1"). Because this is my Theory-Box, I want instead of "Section 0.1" something like "Theory-Box 0.1". –  Latex_NOOB Apr 12 '13 at 12:51
You need to define a counter variable (with the \newcounter command), execute \refstepcounter on that variable when you custom environment is entered, provide a \label to the instance(s) of the environment you'd like to cross-reference, and tell hyperref what the name should be of cross-referenced instances of your environment. –  Mico Apr 12 '13 at 15:35
Use \newmdtheoremenv and everything will work –  Marco Daniel Apr 12 '13 at 15:38
Use the optional argument of \newcounter, set it to either chapter or section. See de.wikibooks.org/wiki/LaTeX-Wörterbuch:_newcounter –  Axel Sommerfeldt Apr 13 '13 at 9:21