PDA

Archiv verlassen und diese Seite im Standarddesign anzeigen : \ref Problem mit measuredfigure



Fite
11-02-2013, 19:46
Hi Leute,

habe das Problem, dass meine Referenz nicht angezeigt wird, sobald ich
\begin{measuredfigure} und \end{measuredfigure} einblende. Wisst ihr, woran das liegen könnte und was man dagegen tun kann?

VG
Philo


\documentclass[12pt,a4paper]{article}
\usepackage[utf8]{inputenc}
\usepackage[ngerman]{babel}
\usepackage{tikz}
\usepackage{threeparttable}

\begin{document}

\begin{figure}[htbp]
\begin{measuredfigure}

\begin{tikzpicture}
\draw[dashed] (0,0)--(10.5,0);
\end{tikzpicture}

\caption{Darstellung}
\label{fig:Abbott-2}

\end{measuredfigure}
\end{figure}

In Abbildung \ref{fig:Abbott-2} sieht man, dass...

\end{document}

Curryhunter
11-02-2013, 19:56
\documentclass[12pt,a4paper]{article}
\usepackage[utf8]{inputenc}
\usepackage[ngerman]{babel}
\usepackage{tikz}
\usepackage{threeparttable}

\begin{document}

\begin{figure}[htbp]
\begin{measuredfigure}
\begin{tikzpicture}
\draw[dashed] (0,0)--(10.5,0);
\end{tikzpicture}
\end{measuredfigure}

\caption{Darstellung}
\label{fig:Abbott-2}

\end{figure}

In Abbildung \ref{fig:Abbott-2} sieht man, dass...

\end{document}
funktioniert.

Fite
11-02-2013, 20:07
........merci :)

localghost
11-02-2013, 20:38
Bezug nehmend auf dein anderes Problem musst du dann aber auf die Ausrichtung der Beschriftung verzichten. Das scheint ein Bug in threeparttable (http://ctan.org/pkg/threeparttable) zu sein, der mir nicht bewusst war. Aber immerhin erkennt caption (http://ctan.org/pkg/caption) das.

\documentclass[11pt,a4paper,ngerman]{article}
\usepackage[T1]{fontenc}
\usepackage{selinput} % Halbautomatische Festlegung
\SelectInputMappings{ % der Eingabekodierung mit Hilfe
adieresis={ä}, % ausgewählter Glyphen
germandbls={ß}, % siehe: http://partners.adobe.com/public/developer/en/opentype/glyphlist.txt
Euro={€}
}
\usepackage{babel}
\usepackage{caption}
\usepackage{threeparttable}
\usepackage{tikz}

\begin{document}
\section{Grundlegende mathematische Modelle}
\subsection{Abbott-Modell}

\begin{figure}[!htb]
\centering
\begin{measuredfigure}
\begin{tikzpicture}
\draw[dashed] (0,0) -- (10.5,0);
\end{tikzpicture}
\caption{Darstellung der Oberfläche einer Metallprobe und einer gegenüberliegenden starren, ideal glatten Oberfläche}
\label{abb:Abbott-1}
\end{measuredfigure}
\end{figure}

Abb.\ \ref{abb:Abbott-1}
\end{document}
Diese Beispiel liefert in der Log-Datei entsprechende Warnungen.

Package caption Warning: \label without proper \caption on input line 25.
See the caption package documentation for explanation.


LaTeX Warning: Reference `abb:Abbott-1' on page 1 undefined on input line 29.
Ohne caption (http://ctan.org/pkg/caption) gibt der Compiler keinen Ton von sich. Daher solltest du vielleicht auf die von mir schon vorgeschlagene Alternative floatrow (http://ctan.org/pkg/floatrow) ausweichen.

\documentclass[11pt,a4paper,ngerman]{article}
\usepackage[T1]{fontenc}
\usepackage{selinput} % Halbautomatische Festlegung
\SelectInputMappings{ % der Eingabekodierung mit Hilfe
adieresis={ä}, % ausgewählter Glyphen
germandbls={ß}, % siehe: http://partners.adobe.com/public/developer/en/opentype/glyphlist.txt
Euro={€}
}
\usepackage{babel}
\usepackage{floatrow}
\usepackage{tikz}

\begin{document}
\section{Grundlegende mathematische Modelle}
\subsection{Abbott-Modell}

\begin{figure}[!htb]
\centering
\ffigbox[\FBwidth]{
\caption{Darstellung der Oberfläche einer Metallprobe und einer gegenüberliegenden starren, ideal glatten Oberfläche}
\label{abb:Abbott-1}
}{
\begin{tikzpicture}
\draw[dashed] (0,0) -- (10,0);
\end{tikzpicture}
}
\end{figure}

Abb.\ \ref{abb:Abbott-1}
\end{document}


Thorsten

sommerfee
12-02-2013, 07:16
Das scheint ein Bug in threeparttable (http://ctan.org/pkg/threeparttable) zu sein, der mir nicht bewusst war.

Es ist immerhin mit "...measuredfigure... It is fairly fragile though" in der Dokumentation angedeutet.

Um den Fragesteller noch mehr zu verwirren, biete ich eine weitere Alternative an:



\documentclass[11pt,a4paper,ngerman]{article}
\usepackage[T1]{fontenc}
\usepackage{selinput} % Halbautomatische Festlegung
\SelectInputMappings{ % der Eingabekodierung mit Hilfe
adieresis={ä}, % ausgewählter Glyphen
germandbls={ß}, % siehe: http://partners.adobe.com/public/developer/en/opentype/glyphlist.txt
Euro={€}
}
\usepackage{babel}
\usepackage{caption}
\usepackage{tikz}

\begin{document}
\section{Grundlegende mathematische Modelle}
\subsection{Abbott-Modell}

\begin{figure}[!htb]
\centering
\captionbox{%
Darstellung der Oberfläche einer Metallprobe und einer gegenüberliegenden starren, ideal glatten Oberfläche
\label{abb:Abbott-1}%
}{%
\begin{tikzpicture}
\draw[dashed] (0,0) -- (10,0);
\end{tikzpicture}
}
\end{figure}

Abb.\ \ref{abb:Abbott-1}
\end{document}


\captionbox ist leider noch nicht in der Dokumentation des caption-Paketes erwähnt (weil ich noch nicht dazu gekommen bin, das nachzupflegen), aber die Syntax ist identisch zu \subcaptionbox, welches in der subcaption-Paketdokumentation dargelegt ist. (\captionbox war auch quasi als Abfallprodukt bei der Implementation von \subcaptionbox entstanden.)