PDA

Archiv verlassen und diese Seite im Standarddesign anzeigen : Eigenes Abbildungs- und Listingverzeichnis für den Anhang



k-b
09-07-2010, 10:41
Guten Tag! Bin momentan an meiner Bachelor-Thesis. Fast fertig. Jetzt gibt es noch ein kleines Problem bei der Form.

Ich habe einen recht umfangreichen Anhang. Viele Codelistings, viele Bilder.
Die Bilder und Codelisstings sollen aber nicht in die Verzeichnis vom Anfang der Arbeit, also nicht dem Kernteil der Arbeit.

Es soll ein eigenes Verzeichnis für den Anhang der Arbeit geben.
Ein zweites Dokument ist leider nicht möglich, da ich viel mit ref auf den Anhang verweise.

Hier mal mein Minimalbeispiel:


% Automatisierte Erfassung statistischer Nutzungsdaten von Facebook-Anwendungen mittels eines Gems für Ruby on Rails.
\documentclass[12pt,a4paper]{scrartcl}
\usepackage{ngerman}
\usepackage[utf8]{inputenc}

% Bilder
\usepackage{graphicx}
\usepackage{float}
\restylefloat{figure}

%Links
\usepackage[plainpages=false]{hyperref}

\usepackage{listings}
\lstset{
language=Ruby,
showspaces=false,
showstringspaces=false,
breaklines=true
}
\renewcommand{\lstlistlistingname}{Listingverzeich nis}

\begin{document}

\tableofcontents

\newpage
\phantomsection
\addcontentsline{toc}{section}{Abbildungsverzeichn is}
\section*{Abbildungsverzeichnis}
\markboth{Abbildungsverzeichnis}{Abbildungsverzeic hnis}
\listoffigures

\newpage
\phantomsection
\addcontentsline{toc}{section}{Listingsverzeichnis }
\lstlistoflistings

\newpage
\section{Kernteil Kapitel}
Hier section 1, was hier ist, kommt ins Inhaltsverzeichnis.

\begin{figure}
\begin{center}
\includegraphics[width=15cm]{tetris_news.png}
\caption{Tetris News 1}
\label{tetris_news}
\end{center}
\end{figure}

\begin{figure}
\begin{center}
\includegraphics[width=15cm]{tetris_news.png}
\caption{Tetris News 2}
\label{tetris_news}
\end{center}
\end{figure}


\begin{lstlisting}[captionpos=b, caption=Listing 1 Kernteil]
Code
\end{lstlisting}


\begin{lstlisting}[captionpos=b, caption=Listing 2 Kernteil]
Code auch hier
\end{lstlisting}



\newpage

\appendix

\section*{Anhang}

\section{Lala}
\label{sec:lala}
Das was hier ist, soll in ein eigenes, Anhangsverzeichnis zu Beginn des Anhangs.

\begin{lstlisting}[captionpos=b, caption=Listing 3 Anhang]
Code auch hier, aber der soll nicht auftauchen im Hauptverzeichnis
\end{lstlisting}

\begin{figure}
\begin{center}
\includegraphics[width=15cm]{tetris_news.png}
\caption{Tetris News 3, soll nicht auftauchen.}
\label{tetris_news}
\end{center}
\end{figure}

\end{document}

Ich bin wirklich verzweifelt. :(

mechanicus
09-07-2010, 14:03
Hi,


% Automatisierte Erfassung statistischer Nutzungsdaten von Facebook-Anwendungen mittels eines Gems für Ruby on Rails.
\documentclass[12pt,a4paper,ngerman,demo]{scrartcl}
\usepackage[listings]{scrhack}
\KOMAoptions{listof=totoc}
\usepackage{babel}
\usepackage[utf8]{inputenc}

% Bilder
\usepackage{graphicx}
\usepackage{float}
\restylefloat{figure}

%Links
\usepackage[plainpages=false]{hyperref}

\usepackage{listings}
\lstset{
language=Ruby,
showspaces=false,
showstringspaces=false,
breaklines=true
}
\renewcommand{\lstlistlistingname}{Listingverzeich nis}


\addtotoclist[float]{laf}%laf:=list appendix figure
\addtotoclist[float]{lat}%lat:=list appendix table
\addtotoclist[float]{lal}%lal:=list appendix listings
\makeatletter
\g@addto@macro\appendix{%
\renewcommand*{\ext@figure}{laf}
\renewcommand*\listoffigures{\listoftoc[\listfigurename~Anhang]{laf}}
\renewcommand*{\ext@table}{lat}
\renewcommand*\listoftables{\listoftoc[\listtablename~Anhang]{lat}}
\renewcommand*\lstlistoflistings{\listoftoc[\lstlistlistingname~Anhang]{lal}}
\def\lst@MakeCaption#1{%
\lst@ifdisplaystyle
\ifx #1t%
\ifx\lst@@caption\@empty\expandafter\lst@HRefStepC ounter \else
\expandafter\refstepcounter
\fi {lstlisting}%
\ifx\lst@label\@empty\else \label{\lst@label}\fi
\let\lst@arg\lst@intname \lst@ReplaceIn\lst@arg\lst@filenamerpl
\global\let\lst@name\lst@arg \global\let\lstname\lst@name
\lst@ifnolol\else
\ifx\lst@@caption\@empty
\ifx\lst@caption\@empty
\ifx\lst@intname\@empty \else \def\lst@temp{ }%
\ifx\lst@intname\lst@temp \else
\addcontentsline{lal}{lstlisting}\lst@name
\fi\fi
\fi
\else
\addcontentsline{lal}{lstlisting}%
{\protect\numberline{\thelstlisting}\lst@@caption} %
\fi
\fi
\fi
\ifx\lst@caption\@empty\else
\lst@IfSubstring #1\lst@captionpos
{\begingroup \let\@@vskip\vskip
\def\vskip{\afterassignment\lst@vskip \@tempskipa}%
\def\lst@vskip{\nobreak\@@vskip\@tempskipa\nobreak }%
\par\@parboxrestore\normalsize\normalfont % \noindent (AS)
\ifx #1t\allowbreak \fi
\ifx\lst@title\@empty
\lst@makecaption\fnum@lstlisting{\ignorespaces \lst@caption}
\else
\lst@maketitle\lst@title % (AS)
\fi
\ifx #1b\allowbreak \fi
\endgroup}{}%
\fi
\fi}
}
\makeatother


\begin{document}

\tableofcontents

\clearpage
\listoffigures
\lstlistoflistings

\clearpage
\section{Kernteil Kapitel}
Hier section 1, was hier ist, kommt ins Inhaltsverzeichnis.

\begin{figure}[!ht]
\centering
\includegraphics[width=15cm]{tetris_news.png}
\caption{Tetris News 1}
\label{tetris_news}
\end{figure}

\begin{figure}[!ht]
\centering
\includegraphics[width=15cm]{tetris_news.png}
\caption{Tetris News 2}
\label{tetris_news}
\end{figure}


\begin{lstlisting}[captionpos=b, caption=Listing 1 Kernteil]
Code
\end{lstlisting}


\begin{lstlisting}[captionpos=b, caption=Listing 2 Kernteil]
Code auch hier
\end{lstlisting}



\clearpage
\appendix

\section*{Anhang}

\listoffigures
\lstlistoflistings

\clearpage
\section{Lala}
\label{sec:lala}
Das was hier ist, soll in ein eigenes, Anhangsverzeichnis zu Beginn des Anhangs.

\begin{lstlisting}[captionpos=b, caption=Listing 3 Anhang]
Code auch hier, aber der soll nicht auftauchen im Hauptverzeichnis
\end{lstlisting}

\begin{figure}[!ht]
\begin{center}
\includegraphics[width=15cm]{tetris_news.png}
\caption{Tetris News 3, soll nicht auftauchen.}
\label{tetris_news}
\end{center}
\end{figure}

\end{document}

du solltest mehr mit Koma-Optionen arbeiten bspw:

\KOMAoptions{listof=totoc}


Gruß
Marco

EDIT: Fehler beseitigt. Danke lockstep

lockstep
09-07-2010, 14:23
@mechanicus: Kleine Korrektur:



\g@addto@macro\appendix{%
\renewcommand*{\ext@figure}{laf}
\renewcommand*\listoffigures{\listoftoc[\listfigurename~Anhang]{laf}}
\renewcommand*{\ext@table}{lat}
\renewcommand*\listoftables{\listoftoc[\listtablename~Anhang]{lat}}
\renewcommand*\lstlistoflistings{\listoftoc[\lstlistlistingname~Anhang]{lal}}


Ansonsten: Tolle Lösung!

lockstep

mechanicus
09-07-2010, 14:36
@mechanicus: Kleine Korrektur:

verdammt :D

Hätte doch noch eine Tabelle einbauen sollen ;)

Gruß
Marco

lockstep
09-07-2010, 14:58
Du hättest nur dein tolles Beispiel genau ansehen müssen: Das Anhangs-Abbildungsverzeichnis war leer. ;)

lockstep

mechanicus
09-07-2010, 15:10
Du hättest nur dein tolles Beispiel genau ansehen müssen: Das Anhangs-Abbildungsverzeichnis war leer. ;)

das mit der Tabelle habe ich ohne zu testen eingefügt. Das war der Fehler. Also doch: immer testen. :p

k-b
10-07-2010, 14:36
Vielen vielen lieben dank!!

k-b
10-07-2010, 15:29
Ich habe versucht, das Beispiel noch zu erweitern. Also so, dass auch das Inhaltsverzeichnis für den Anhang ein eigenes ist.
Leider hab ich es nicht hinbekommen :(



\documentclass[12pt,a4paper,ngerman,demo]{scrartcl}
\usepackage[listings]{scrhack}
\KOMAoptions{listof=totoc}
\usepackage{babel}
\usepackage[utf8]{inputenc}

% Bilder
\usepackage{graphicx}
\usepackage{float}
\restylefloat{figure}

%Links
\usepackage[plainpages=false]{hyperref}

\usepackage{listings}
\lstset{
language=Ruby,
showspaces=false,
showstringspaces=false,
breaklines=true
}
\renewcommand{\lstlistlistingname}{Listingverzeich nis}


\addtotoclist[float]{laf}%laf:=list appendix figure
\addtotoclist[float]{lat}%lat:=list appendix table
\addtotoclist[float]{lal}%lal:=list appendix listings
\addtotoclist[float]{tac}%lal:=list appendix listings
\makeatletter
\g@addto@macro\appendix{%
\renewcommand*{\ext@figure}{laf}
\renewcommand*\listoffigures{\listoftoc[\listfigurename~Anhang]{laf}}
\renewcommand*{\ext@table}{lat}
\renewcommand*\listoftables{\listoftoc[\listtablename~Anhang]{lat}}
\renewcommand*\tableofcontents{\listoftoc[Inhaltsverzeichnis Anhang]{tac}}
\renewcommand*\lstlistoflistings{\listoftoc[\lstlistlistingname~Anhang]{lal}}
\def\lst@MakeCaption#1{%
\lst@ifdisplaystyle
\ifx #1t%
\ifx\lst@@caption\@empty\expandafter\lst@HRefStepC ounter \else
\expandafter\refstepcounter
\fi {lstlisting}%
\ifx\lst@label\@empty\else \label{\lst@label}\fi
\let\lst@arg\lst@intname \lst@ReplaceIn\lst@arg\lst@filenamerpl
\global\let\lst@name\lst@arg \global\let\lstname\lst@name
\lst@ifnolol\else
\ifx\lst@@caption\@empty
\ifx\lst@caption\@empty
\ifx\lst@intname\@empty \else \def\lst@temp{ }%
\ifx\lst@intname\lst@temp \else
\addcontentsline{lal}{lstlisting}\lst@name
\fi\fi
\fi
\else
\addcontentsline{lal}{lstlisting}%
{\protect\numberline{\thelstlisting}\lst@@caption} %
\fi
\fi
\fi
\ifx\lst@caption\@empty\else
\lst@IfSubstring #1\lst@captionpos
{\begingroup \let\@@vskip\vskip
\def\vskip{\afterassignment\lst@vskip \@tempskipa}%
\def\lst@vskip{\nobreak\@@vskip\@tempskipa\nobreak }%
\par\@parboxrestore\normalsize\normalfont % \noindent (AS)
\ifx #1t\allowbreak \fi
\ifx\lst@title\@empty
\lst@makecaption\fnum@lstlisting{\ignorespaces \lst@caption}
\else
\lst@maketitle\lst@title % (AS)
\fi
\ifx #1b\allowbreak \fi
\endgroup}{}%
\fi
\fi}
}
\makeatother


\begin{document}

\tableofcontents

\clearpage
\listoffigures
\lstlistoflistings

\clearpage
\section{Kernteil Kapitel}
Hier section 1, was hier ist, kommt ins Inhaltsverzeichnis.

\begin{figure}[!ht]
\centering
\includegraphics[width=15cm]{tetris_news.png}
\caption{Tetris News 1}
\label{tetris_news}
\end{figure}

\begin{figure}[!ht]
\centering
\includegraphics[width=15cm]{tetris_news.png}
\caption{Tetris News 2}
\label{tetris_news}
\end{figure}


\begin{lstlisting}[captionpos=b, caption=Listing 1 Kernteil]
Code
\end{lstlisting}


\begin{lstlisting}[captionpos=b, caption=Listing 2 Kernteil]
Code auch hier
\end{lstlisting}



\clearpage
\appendix

\section*{Anhang}

\tableofcontents

\listoffigures
\lstlistoflistings

\clearpage
\section{Lala}
\label{sec:lala}
Das was hier ist, soll in ein eigenes, Anhangsverzeichnis zu Beginn des Anhangs.

\begin{lstlisting}[captionpos=b, caption=Listing 3 Anhang]
Code auch hier, aber der soll nicht auftauchen im Hauptverzeichnis
\end{lstlisting}

\begin{figure}[!ht]
\begin{center}
\includegraphics[width=15cm]{tetris_news.png}
\caption{Tetris News 3, soll nicht auftauchen.}
\label{tetris_news}
\end{center}
\end{figure}

\end{document}

rais
10-07-2010, 16:41
Moin moin,

Ich habe versucht, das Beispiel noch zu erweitern. Also so, dass auch das Inhaltsverzeichnis für den Anhang ein eigenes ist.
Leider hab ich es nicht hinbekommen :(

na ja, Du müsstest diese tac im Anhang dann auch mit Inhalt füllen, vllt


\appendix
\newcommand*\origaddcontentsline{}%
\let\origaddcontentsline\addcontentsline
\renewcommand*\addcontentsline[3]{%
\ifthenelse{\equal{#1}{toc}}{\origaddcontentsline{ tac}{#2}{#3}}{\origaddcontentsline{#1}{#2}{#3}}%
}
(erfordert ifthen-Paket)

MfG

mechanicus
10-07-2010, 16:56
Hi,

unter Berücksichtigung von Rainers Vorschlag:

\documentclass[12pt,a4paper,ngerman,demo]{scrartcl}
\usepackage[listings]{scrhack}
\KOMAoptions{listof=totoc}
\usepackage{babel}
\usepackage[utf8]{inputenc}

% Bilder
\usepackage{graphicx}
\usepackage{float}
\restylefloat{figure}
\usepackage{ifthen}
%Links
\usepackage[plainpages=false]{hyperref}

\usepackage{listings}
\lstset{
language=Ruby,
showspaces=false,
showstringspaces=false,
breaklines=true
}
\renewcommand{\lstlistlistingname}{Listingverzeich nis}


\addtotoclist[float]{laf}%laf:=list appendix figure
\addtotoclist[float]{lat}%lat:=list appendix table
\addtotoclist[float]{lal}%lal:=list appendix listings
\addtotoclist{tac}%lal:=table appendix contents
\makeatletter
\g@addto@macro\appendix{%
\renewcommand*{\ext@figure}{laf}
\renewcommand*\listoffigures{\listoftoc[\listfigurename~Anhang]{laf}}
\renewcommand*{\ext@table}{lat}
\renewcommand*\listoftables{\listoftoc[\listtablename~Anhang]{lat}}
\newcommand*\origaddcontentsline{}%
\let\origaddcontentsline\addcontentsline
\renewcommand*\addcontentsline[3]{%
\ifthenelse{\equal{#1}{toc}}{\origaddcontentsline{ tac}{#2}{#3}}{\origaddcontentsline{#1}{#2}{#3}}}
\renewcommand*\tableofcontents{\begingroup\let\if@ dynlist\if@tocleft\listoftoc[\contentsname~Anhang]{tac}\endgroup}
\renewcommand*\lstlistoflistings{\listoftoc[\lstlistlistingname~Anhang]{lal}}
\def\lst@MakeCaption#1{%
\lst@ifdisplaystyle
\ifx #1t%
\ifx\lst@@caption\@empty\expandafter\lst@HRefStepC ounter \else
\expandafter\refstepcounter
\fi {lstlisting}%
\ifx\lst@label\@empty\else \label{\lst@label}\fi
\let\lst@arg\lst@intname \lst@ReplaceIn\lst@arg\lst@filenamerpl
\global\let\lst@name\lst@arg \global\let\lstname\lst@name
\lst@ifnolol\else
\ifx\lst@@caption\@empty
\ifx\lst@caption\@empty
\ifx\lst@intname\@empty \else \def\lst@temp{ }%
\ifx\lst@intname\lst@temp \else
\addcontentsline{lal}{lstlisting}\lst@name
\fi\fi
\fi
\else
\addcontentsline{lal}{lstlisting}%
{\protect\numberline{\thelstlisting}\lst@@caption} %
\fi
\fi
\fi
\ifx\lst@caption\@empty\else
\lst@IfSubstring #1\lst@captionpos
{\begingroup \let\@@vskip\vskip
\def\vskip{\afterassignment\lst@vskip \@tempskipa}%
\def\lst@vskip{\nobreak\@@vskip\@tempskipa\nobreak }%
\par\@parboxrestore\normalsize\normalfont % \noindent (AS)
\ifx #1t\allowbreak \fi
\ifx\lst@title\@empty
\lst@makecaption\fnum@lstlisting{\ignorespaces \lst@caption}
\else
\lst@maketitle\lst@title % (AS)
\fi
\ifx #1b\allowbreak \fi
\endgroup}{}%
\fi
\fi}
}
\makeatother


\begin{document}

\tableofcontents

\clearpage
\listoffigures
\lstlistoflistings

\clearpage
\section{Kernteil Kapitel}
Hier section 1, was hier ist, kommt ins Inhaltsverzeichnis.

\begin{figure}[!ht]
\centering
\includegraphics[width=15cm]{tetris_news.png}
\caption{Tetris News 1}
\label{tetris_news}
\end{figure}

\begin{figure}[!ht]
\centering
\includegraphics[width=15cm]{tetris_news.png}
\caption{Tetris News 2}
\label{tetris_news}
\end{figure}


\begin{lstlisting}[captionpos=b, caption=Listing 1 Kernteil]
Code
\end{lstlisting}


\begin{lstlisting}[captionpos=b, caption=Listing 2 Kernteil]
Code auch hier
\end{lstlisting}



\clearpage
\appendix

\section*{Anhang}

\tableofcontents

\listoffigures
\lstlistoflistings

\clearpage
\section{Lala}
\label{sec:lala}
Das was hier ist, soll in ein eigenes, Anhangsverzeichnis zu Beginn des Anhangs.

\begin{lstlisting}[captionpos=b, caption=Listing 3 Anhang]
Code auch hier, aber der soll nicht auftauchen im Hauptverzeichnis
\end{lstlisting}

\begin{figure}[!ht]
\begin{center}
\includegraphics[width=15cm]{tetris_news.png}
\caption{Tetris News 3, soll nicht auftauchen.}
\label{tetris_news}
\end{center}
\end{figure}

\end{document}

toc-Einträge sind nicht vom typ float.

Gruß
Marco

lockstep
10-07-2010, 17:01
@rais: Elegante Erweiterung!

Was müsste man ändern, um das "Inhaltsverzeichnis Anhang" nicht in sich selbst aufzunehmen (analog zum Hauptinhaltsverzeichnis)?

lockstep

EDIT: Offenbar ist das mechanicus auch bereits aufgefallen. :D