0

As a beginner, I will ask a question from a beginner. And I am a little bit lost with Latex packages documentation since there is, well, a lot of text ! (I prefer figures).

I read in Koma-Script manual this:

But often these floating environments are slightly misunderstood by beginners. They often ask for a fixed position of a table or figure within the text.

I need to write course materials (but not a book) with a lot figures and images and maths formulas. I would like to position the figures in the order and as close as possible from the text that reference them.

Having an image at the top or at the bottom of the page is sometimes not correct for me.

I tried to do this:

\documentclass[fontsize=12,a4paper,twoside,headheight=0.5cm,headsepline]{scrreprt}
\usepackage[T1]{fontenc}
\usepackage[bottom=2cm,footskip=15mm]{geometry}
\usepackage{scrlayer-scrpage}
\usepackage[utf8]{inputenc}
\usepackage[frenchb]{babel}
\usepackage{lipsum}
\usepackage{a4}
\title{Trying to Latexize my materials}

\KOMAoptions{BCOR=2mm,DIV=22}

\usepackage{eso-pic}
\usepackage{graphicx}
\usepackage{geometry,color,float}

\AddToShipoutPictureBG{%
    \AtPageUpperLeft{
        \put(10,-10){%
            \raisebox{-\height}{\includegraphics[width=2cm]{example-image-c}}
        }
    }
}

\usepackage{mwe} % for blindtext and example-image-a in example
\usepackage{wrapfig} %not KOMA: is it compatible ?

\pagestyle{scrheadings}
\cfoot{Le pied de page}
\rehead{En haut à droite pair}
\rohead{En haut à droite impair}
\cehead{centre pair}
\cohead{centre impair}


\begin{document}
\maketitle
\chapter{Starting}
\section{My first section}
\subsection{a subsection: introduction}
This is my first \LaTeX document !


\begin{figure}[th]
        \centering
        \includegraphics[width=300pt]{example-image-a}
        \caption{capt}
\end{figure}


\lipsum[2]
\subsection{an image in this section}
There is an image below I want to comment now.

\begin{wrapfigure}{l}{0.5\textwidth}
\centering
\includegraphics[width=.98\linewidth]{example-image-a}
\caption{A caption}
\end{wrapfigure}

\lipsum[4]

\subsection{another image in this section}
And another one here

\begin{wrapfigure}{r}{0.5\textwidth}
\centering
\includegraphics[width=.98\linewidth]{example-image-b}
\caption{A caption}
\end{wrapfigure}

\lipsum[6]
\fbox{\begin{minipage}{0.9\textwidth}
     ''text''
\end{minipage}}

\end{document}

But as you can see in document which is here (to download the document follow the link and then click the download button, do not right-click then "Save target as...").

the second A image is misplaced at the bottom (as well as the following text). And I don't want the second A image (left placed) to be so close to the bottom. I don't want neither the 1.1.3 subsubsection to be shifted to the right like this. I would like the paragraph to be wrapped and the the 1.1.3 section to be left justified.

I am less interested in a perfect typographic layout than in a technical documentation layout with, sometimes, more text (I have 30% text, 70% figures/tables/images).

What is a good way to do this using KOMA-script ? Or am I on a wrong path and should I change my way of writing it ?

My target type of document can be found here this.

lauhub
  • 766
  • 1
    If you do not want your figures to float, don't use the figure environment. You can use \captionof{figure}{actual caption} to get a caption. You might want to put this inside a minipage. – Johannes_B Feb 13 '14 at 10:07
  • Have you looked at the float package and its [H] ("HERE") position specifier? – Mico Feb 13 '14 at 10:22
  • @Mico Thank you for your answer. Yes I looked at it, but my question is to know if I can use it with KOMA. – lauhub Feb 13 '14 at 10:43
  • @Johannes__B I am currently trying it but get some errors with my images – lauhub Feb 13 '14 at 10:43
  • I finally did it: minipage + captionof seems to be fine for me. Searching in the forum gave me some clue on how to do this. What should I do with this topic for now ? – lauhub Feb 13 '14 at 12:23
  • @Mico: Not needed at all since there is the already mentioned \captionof. This sledgehammer method is in general absolutely obsolete nowadays. – Thorsten Donig Feb 13 '14 at 15:13
  • @ThorstenDonig - Please note that I did not state that the OP should use the [H] method to specify the location of a float. Incidentally, as a matter of logic, I fail to see how putting a table or figure inside a minipage environment (and using the \captof instruction to generate a numbered caption) is less of a sledgehammer solution to the problem of placing these items on a page than the [H] method is supposed to be. – Mico Feb 13 '14 at 16:51
  • @Mico: The sledgehammer method is too put something into a float environment and then prevent this environment from what it is supposed to do primarily, namely floating. That's simply irrational. – Thorsten Donig Feb 13 '14 at 17:13
  • @ThorstenDonig - A defendable (and thus rational?!) reason for using the [H] method is that if the user changes his/her mind at some point in the future and decides to let a figure or table environment "float around" after all, it's trivially easy to do so by deleting the associated [H] placement specifier (and replacing it, if needed, with [t] or something more appropriate); no further editing required. :-) For what it's worth, in my own papers I never use either the [H] or the \captionof method; however, the needs of other writers will almost certainly differ from mine. – Mico Feb 13 '14 at 17:38
  • We should invent a system to let the different writers vote for one or the other solution. Isn't it a good idea ? ;-) – lauhub Feb 13 '14 at 17:42
  • @Mico: If it's only about editing and later modifications, a proper environment for fixed figures can be set up very easily. – Thorsten Donig Feb 13 '14 at 18:43
  • @lauhub: You could write an answer yourself. – Speravir Feb 13 '14 at 19:16

0 Answers0