Probleme mit Floats

Tabellen und Grafiken erstellen und anordnen


tob1wan
Forum-Newbie
Forum-Newbie
Beiträge: 7
Registriert: Fr 3. Dez 2010, 22:39

Probleme mit Floats

Beitrag von tob1wan »

Hallo,
zu folgendem Code habe ich ein Problem. Wenn ich mir das ausgeben lasse, habe ich meistens die Rechtecke auf einer Seite, bzw. am Ende des Textes. Ich möchte aber, dass eigentlich auf jeder Seite Text ist und das Ganze auch mit Text aufhört.

Erreiche ich das nicht durch textfraction? Oder heißt das nur, dass wenn Text auf der Seite ist, dieser 15 % der ganzen Seite einnimmt?

Wäre toll, wenn mir da einer weiterhelfen könnte.
\documentclass[a4paper,10pt]{article}
\usepackage[english]{babel}
\usepackage[utf8]{inputenc}
\usepackage[T1]{fontenc}

\usepackage{float}
\setcounter{totalnumber}{1}
\setcounter{topnumber}{1}
\setcounter{bottomnumber}{1}
\renewcommand{\topfraction}{.8}
\renewcommand{\bottomfraction}{.5}
\renewcommand{\floatpagefraction}{.66}
\renewcommand{\textfraction}{.15}
\usepackage[section]{placeins}

\begin{document}

\section{This is a test}

The TeX project was started in 1978 by D Knuth, while revising the second volume of his Art of Computer Programming. When he got the
galleys back, he saw that the publisher had switched to a new digital typesetting system and was shocked at the poor quality (\ref{Gleitobjekt1}).

\begin{figure}
\centering
\rule{.3\linewidth}{2cm}
\caption{Rule}
\label{Gleitobjekt1}
\end{figure}

He reasoned that because digital typesetting meant arranging 1's and 0's (ink and no ink) in the proper pattern, as a computer scientist
he should be able to do the job better. He originally estimated that this would take six months but ultimately it took nearly ten years.
He had to handle not only the challenges of routine typesetting such as right-justification and page formatting flexible enough to allow
for different output styles, but also the additional demands of academic publishing -- footnotes, floating figures and tables, etc. And,
beyond that, he had to tell the computer how to typset formulas and other technical materials (\ref{Gleitobjekt2}).

\begin{figure}
\centering
\rule{.3\linewidth}{5cm}
\caption{Rule}
\label{Gleitobjekt2}
\end{figure}

A year after he began, Knuth was invited to present one of the principal lectures at the AMS's annual meeting. He spoke on his TeX work,
and also on Metafont (his system for developing fonts). He presented not only the roots of the typographical concepts, but also the
mathematical notions on which these two programs are based. TeX's popularity took off from there.

An important boost to that popularity came in 1985 with the introduction by L Lamport of LaTeX, a set of commands that allows interaction
with the system at a higher level than Knuth's original set (which is called Plain TeX) (\ref{Gleitobjekt3}).

\begin{figure}
\centering
\rule{.3\linewidth}{10cm}
\caption{Rule}
\label{Gleitobjekt3}
\end{figure}

The TeX project was started in 1978 by D Knuth, while revising the second volume of his Art of Computer Programming. When he got the
galleys back, he saw that the publisher had switched to a new digital typesetting system and was shocked at the poor quality (\ref{Gleitobjekt4}).

\begin{figure}
\centering
\rule{.3\linewidth}{8cm}
\caption{Rule}
\label{Gleitobjekt4}
\end{figure}

He reasoned that because digital typesetting meant arranging 1's and 0's (ink and no ink) in the proper pattern, as a computer scientist
he should be able to do the job better. He originally estimated that this would take six months but ultimately it took nearly ten years.
He had to handle not only the challenges of routine typesetting such as right-justification and page formatting flexible enough to allow
for different output styles, but also the additional demands of academic publishing -- footnotes, floating figures and tables, etc. And,
beyond that, he had to tell the computer how to typset formulas and other technical materials (\ref{Gleitobjekt5}).

\begin{figure}
\centering
\rule{.3\linewidth}{7cm}
\caption{Rule}
\label{Gleitobjekt5}
\end{figure}

A year after he began, Knuth was invited to present one of the principal lectures at the AMS's annual meeting. He spoke on his TeX work,
and also on Metafont (his system for developing fonts). He presented not only the roots of the typographical concepts, but also the
mathematical notions on which these two programs are based. TeX's popularity took off from there.

An important boost to that popularity came in 1985 with the introduction by L Lamport of LaTeX, a set of commands that allows interaction
with the system at a higher level than Knuth's original set (which is called Plain TeX) (\ref{Gleitobjekt6}).

\begin{figure}
\centering
\rule{.3\linewidth}{2cm}
\caption{Rule}
\label{Gleitobjekt6}
\end{figure}

The TeX project was started in 1978 by D Knuth, while revising the second volume of his Art of Computer Programming. When he got the
galleys back, he saw that the publisher had switched to a new digital typesetting system and was shocked at the poor quality (\ref{Gleitobjekt7}).

\begin{figure}
\centering
\rule{.3\linewidth}{4cm}
\caption{Rule}
\label{Gleitobjekt7}
\end{figure}

He reasoned that because digital typesetting meant arranging 1's and 0's (ink and no ink) in the proper pattern, as a computer scientist
he should be able to do the job better. He originally estimated that this would take six months but ultimately it took nearly ten years.
He had to handle not only the challenges of routine typesetting such as right-justification and page formatting flexible enough to allow
for different output styles, but also the additional demands of academic publishing -- footnotes, floating figures and tables, etc. And,
beyond that, he had to tell the computer how to typset formulas and other technical materials (\ref{Gleitobjekt8}).

\begin{figure}
\centering
\rule{.3\linewidth}{6cm}
\caption{Rule}
\label{Gleitobjekt8}
\end{figure}

A year after he began, Knuth was invited to present one of the principal lectures at the AMS's annual meeting. He spoke on his TeX work,
and also on Metafont (his system for developing fonts). He presented not only the roots of the typographical concepts, but also the
mathematical notions on which these two programs are based. TeX's popularity took off from there.

An important boost to that popularity came in 1985 with the introduction by L Lamport of LaTeX, a set of commands that allows interaction
with the system at a higher level than Knuth's original set (which is called Plain TeX) (\ref{Gleitobjekt9}).

\begin{figure}
\centering
\rule{.3\linewidth}{5cm}
\caption{Rule}
\label{Gleitobjekt9}
\end{figure}

The TeX project was started in 1978 by D Knuth, while revising the second volume of his Art of Computer Programming. When he got the
galleys back, he saw that the publisher had switched to a new digital typesetting system and was shocked at the poor quality (\ref{Gleitobjekt10}).

\begin{figure}
\centering
\rule{.3\linewidth}{11cm}
\caption{Rule}
\label{Gleitobjekt10}
\end{figure}

He reasoned that because digital typesetting meant arranging 1's and 0's (ink and no ink) in the proper pattern, as a computer scientist
he should be able to do the job better. He originally estimated that this would take six months but ultimately it took nearly ten years.
He had to handle not only the challenges of routine typesetting such as right-justification and page formatting flexible enough to allow
for different output styles, but also the additional demands of academic publishing -- footnotes, floating figures and tables, etc. And,
beyond that, he had to tell the computer how to typset formulas and other technical materials (\ref{Gleitobjekt11}).

\begin{figure}
\centering
\rule{.3\linewidth}{6cm}
\caption{Rule}
\label{Gleitobjekt11}
\end{figure}

A year after he began, Knuth was invited to present one of the principal lectures at the AMS's annual meeting. He spoke on his TeX work,
and also on Metafont (his system for developing fonts). He presented not only the roots of the typographical concepts, but also the
mathematical notions on which these two programs are based. TeX's popularity took off from there.

An important boost to that popularity came in 1985 with the introduction by L Lamport of LaTeX, a set of commands that allows interaction
with the system at a higher level than Knuth's original set (which is called Plain TeX) (\ref{Gleitobjekt12}).

\begin{figure}
\centering
\rule{.3\linewidth}{6cm}
\caption{Rule}
\label{Gleitobjekt12}
\end{figure}

The TeX project was started in 1978 by D Knuth, while revising the second volume of his Art of Computer Programming. When he got the
galleys back, he saw that the publisher had switched to a new digital typesetting system and was shocked at the poor quality (\ref{Gleitobjekt13}).

\begin{figure}
\centering
\rule{.3\linewidth}{9cm}
\caption{Rule}
\label{Gleitobjekt13}
\end{figure}

He reasoned that because digital typesetting meant arranging 1's and 0's (ink and no ink) in the proper pattern, as a computer scientist
he should be able to do the job better. He originally estimated that this would take six months but ultimately it took nearly ten years.
He had to handle not only the challenges of routine typesetting such as right-justification and page formatting flexible enough to allow
for different output styles, but also the additional demands of academic publishing -- footnotes, floating figures and tables, etc. And,
beyond that, he had to tell the computer how to typset formulas and other technical materials (\ref{Gleitobjekt14}).

\begin{figure}
\centering
\rule{.3\linewidth}{4cm}
\caption{Rule}
\label{Gleitobjekt14}
\end{figure}

A year after he began, Knuth was invited to present one of the principal lectures at the AMS's annual meeting. He spoke on his TeX work,
and also on Metafont (his system for developing fonts). He presented not only the roots of the typographical concepts, but also the
mathematical notions on which these two programs are based. TeX's popularity took off from there.

An important boost to that popularity came in 1985 with the introduction by L Lamport of LaTeX, a set of commands that allows interaction
with the system at a higher level than Knuth's original set (which is called Plain TeX) (\ref{Gleitobjekt15}).

\begin{figure}
\centering
\rule{.3\linewidth}{5cm}
\caption{Rule}
\label{Gleitobjekt15}
\end{figure}

\listof{figure}{List of Rules}

Xenara
Forum-Meister
Forum-Meister
Beiträge: 682
Registriert: Mi 25. Nov 2009, 09:41

Beitrag von Xenara »

figure ist eine Gleitumgebung, d.h. sie wird dort ausgegeben, wo LaTeX der Meinung ist, dass es typographisch am Besten passt.
Du hast gar keine Parameter für die Positionierung angegeben. Afaik ist Standard [htbp], was LaTeX die Priorität angibt, wo die Bilder hinsollen.
Bei dir scheint p zum Tragen zu kommen, Bilder werden auf einer Extraseite ausgegeben.
Die Parameter bedeuten h(ere) = genau hier, t(op) = oben auf der Seite, b(ottom) = unten auf der Seite und p(age) = auf einer Extraseite.

Probier mal, mit den Parametern zu spielen, z.B.
\begin{figure}[!htbp]
zwingt LaTeX dazu, die Position genau hier verstärkt zu beachten (das heisst aber nicht, dass sie immer dort gesetzt werden).
Oder probier mal, p wegzulassen. Vermutlich erzielst du damit bereits ein wesentlich besseres Ergebnis.

Sonst gibt es noch den Befehl \FloatBarrier aus dem Paket placeins, was bedeutet: Schiebe mir das Bild maximal bis hierhin, aber keinesfalls weiter gleiten.

Oder die ganz harte Variante, die Gleitumgebung ganz weglassen und durch minipage ersetzen (caption durch captionof). Dann werden die Bilder exakt an der Stelle im Text platziert, an der sie aufgerufen werden.

CrazyHorse
Forum-Guru
Forum-Guru
Beiträge: 252
Registriert: Di 16. Mär 2010, 09:39

Re: Probleme mit Floats

Beitrag von CrazyHorse »

tob1wan hat geschrieben:zu folgendem Code habe ich ein Problem. Wenn ich mir das ausgeben lasse, habe ich meistens die Rechtecke auf einer Seite, bzw. am Ende des Textes. Ich möchte aber, dass eigentlich auf jeder Seite Text ist und das Ganze auch mit Text aufhört.

Erreiche ich das nicht durch textfraction? Oder heißt das nur, dass wenn Text auf der Seite ist, dieser 15 % der ganzen Seite einnimmt?
mach es mal so (vor allem ohne das Paket float):
\documentclass[a4paper,10pt]{article}
\usepackage[english]{babel}
\usepackage[utf8]{inputenc}
\usepackage[T1]{fontenc}

\setcounter{totalnumber}{4}
\setcounter{topnumber}{3}
\setcounter{bottomnumber}{3}
\renewcommand{\topfraction}{.8}
\renewcommand{\bottomfraction}{.8}
\renewcommand{\floatpagefraction}{.8}
\renewcommand{\textfraction}{0}

\makeatletter
\renewcommand{\fps@figure}{htb}
\renewcommand{\fps@table}{htb}
\makeatother

%\usepackage[section]{placeins}
\usepackage{flafter}

\begin{document}
...
Herbert

tob1wan
Forum-Newbie
Forum-Newbie
Beiträge: 7
Registriert: Fr 3. Dez 2010, 22:39

Beitrag von tob1wan »

Alles klar.
Danke für die Hilfe. Ich hab mir nur gedacht, dass wenn ich bei \begin{figure}[!htbp] die Zuweisung weglasse, dass ich am Ende weniger nach korrigieren muss.

Antworten