PDA

Archiv verlassen und diese Seite im Standarddesign anzeigen : glossaries: Symbolverzeichnis auf Textbreite



nub
15-04-2008, 14:10
Hallo zusammen,

ich möchte ein Symbolverzeichnis mit glossaries erstellen. Das Verzeichnis soll in tabellarischer Form dargestellt werden und Textbreite besitzen. Die vordefinierten glossarystyles erfüllen diese Bedingung nicht, besitzen nicht die gesamte Textbreite.

Im Prinzip hätte ich gerne eine Darstellung in tabularx-Form (\begin{tabularx}{\textwidth}{lX}\end{tabularx}}

Ich habe versucht einen eigenen glossarystyle auf Basis von tabularx zu definieren, dies klappt aber nicht.



\documentclass{scrreprt}

\usepackage{glossaries}

\makeatletter
\RequirePackage{tabularx}
\newglossarystyle{mylist}{%
\renewenvironment{theglossary}{%
\tablehead{}\tabletail{}%
\begin{tabularx}{\linewidth}{lX}}{%
\end{tabularx}}%
\renewcommand*{\glossaryheader}{}%
\renewcommand*{\glsgroupheading}[1]{}%
\renewcommand*{\glossaryentryfield}[5]{%
\@glstarget{glo:##1}{##2} & ##3\glspostdescription\space ##5\\}%
\renewcommand*{\glsgroupskip}{ & \\}}
\makeatother

\newglossaryentry{symb:etwas}{
name=etwas,
description={Hier steht ein längerer Text, in diesem Fall ohne jegliche Bedeutung oder irgendwelchen Hintergrung, Hauptsache dieser Text ist breiter als die Textbreite.},
}

\makeglossaries

\begin{document}

\gls{symb:etwas}

\printglossary[style=mylist]

\end{document}


Könnt ihr mir da weiterhelfen?

Gruß nub

nub
16-04-2008, 07:28
Geht das mit diesem Paket nicht, oder bin ich der einzige, der das Verzeichnis in der Form benötigt?

nub
16-04-2008, 08:46
Das Problem liegt darin, wie tabularx den "table body" berechnet:

"This mechanism of grabbing an environment body does have the disadvantage (shared with the AMS alignment environments) that you can not make extension environments by code such as

\newenvironment{foo}{\begin{tabularx}{XX}}{\end{ta bularx}}

as the code is looking for a literal string \end{tabularx} to stop scanning. Since version 2.02, one may avoid this problem by using \tabularx and \endtabularx directly in the defition:

\newenvironment{foo}{\tabularx{XX}}{\endtabularx}

The scanner now looks for the end of the current environment (foo in this example.) There are some restrictions on this usage, the principal one being that \endtabularx is the first token of the `end code' of the environment." (aus "The tabularx package", David Carlisle,1999/01/07)

Das oben genannte Bsp. läuft also mit:


\makeatletter
\RequirePackage{tabularx}
\newglossarystyle{mylist}{%
\renewenvironment{theglossary}{%
\tablehead{}\tabletail{}%
\tabularx{\linewidth}{lX}}{%
\endtabularx}%
\renewcommand*{\glossaryheader}{}%
\renewcommand*{\glsgroupheading}[1]{}%
\renewcommand*{\glossaryentryfield}[5]{%
\@glstarget{glo:##1}{##2} & ##3\glspostdescription\space ##5\\}%
\renewcommand*{\glsgroupskip}{ & \\}}
\makeatother


Der selbsterstellte glossary-stlyle "mylist" ist damit eine zweispaltige Tabelle, deren erster Spalte das Symbol (oder was auch immer) und deren zweite Spalte die Beschreibung beinhaltet. Die gesamte Breite der Tabelle entspricht maximal der Textbreite!

Gruß nub