0

Yes, this has been asked before but I can't find an answer. I've been experimenting with LaTeX on overleaf for around 3 months and I still can't get the hang of inserting images. Just let me plonk that shit down, why do I have to add five different modifiers and fiddle for two hours with pixel measurements to make something just fit on the page properly. Is there any way to automatically resize images, everything I try to insert is too large, so it gets off or gets its own page, which looks terrible It's always in the wrong position too, never where I insert it in the source code? What am I missing? I don't think I've ever been this frustrated working with something before besides coding. I know this is more of a rant than a question. If I wanted to plonk stuff down I'd just use a word, but I wanna make it work. If it's just one image it's fine, but inserting 5 or more images shouldn't take hours, should it?

If someone decides to answer this, thank you! I'm not really expecting an answer, I'll probably get banned for having violated some rule I haven't read about because this is too ranty or something.

Clarification: I just wanted to get it out, but let's say I'm starting with the basic:

\begin{figure}
    \centering
    \includegraphics{images/image.jpg}
    \caption{Caption}
    \label{fig:my_label}
\end{figure}

What do I have to do to accomplish these things: 1-I want the image to appear where I put it in the code, not on the next page. 2-The image should be as wide as a line of text. I tried doing this:

\begin{figure}[h!]
    \centering
    \includegraphics[width=\textwidth]{Agrobacteria.PNG}
    \caption{Genomen van \cite{tzfira_agrobacterium-mediated_2006}}
    \label{fig:my_label}
\end{figure}

And it worked, but only on this one picture, when I try to copy the code and place it somewhere else the image moves to the next page or section.

David Carlisle
  • 757,742
  • 1
    You could turn this into a meaningful question by giving a concrete example of how you insert images. The fact that you get wrong sizes and have to "fiddle for two hours with pixel measurements" suggests that you try to use absolute units (cm, in, pt) instead of relative ones (\linewidth), but without seeing your code this is only a guess. – campa May 10 '21 at 12:46
  • How should anyone know what is the "right position" and the "right size" for your document? If you don't learn to ask proper questions you will have to continue to fiddle alone. But a general tip: fine tuning of image size and positions should be done at the end, when the text if finished. – Ulrike Fischer May 10 '21 at 12:47
  • @UlrikeFischer Thank you for answering, I do usually add code to my questions on other websites, I just wanted some sort of general easy guide to images, but I should have been more specific. – DudeThatWantsToInsertImages May 10 '21 at 13:02
  • Well basically you have problems because you don't understand the concept of a float and so fight against it instead of using it correctly. See https://tex.stackexchange.com/a/39020/2388 and https://tex.stackexchange.com/q/370627/2388 – Ulrike Fischer May 10 '21 at 13:07
  • @UlrikeFischer Thank you again. I thought I might have figured it out by experimenting long enough but apparently not, I'll have to actually read about it. – DudeThatWantsToInsertImages May 10 '21 at 13:12
  • 2
    First of don't only use [h!] unless you know what you are doing. At least use [htp!] or [htbp!]. Not that the memoir manual have an explanation of these, that part of the manual can be read independently of which class you use. If your image are very large then it can never be placed by [h!] which requires there to be text above and below or its replacement [t!] which requires there to be text below. This is why the p is so important to always remember. – daleif May 10 '21 at 14:02
  • Note that the [!] is only useful if you have more than 3 floats on a page, or possibly if you are exceeding some size limit. – John Kormylo May 10 '21 at 14:17
  • 1
    if you use \includegraphics the figure appears where you put it. But you are using the figure environment: the only purpose of figure is to specify that its content is not part of the document flow and may be moved and re-inserted to help with page breaking. As you say, your post is a rant not a question but why are you using figure ?????? – David Carlisle May 10 '21 at 18:38

0 Answers0