
Cada vez que incluyo una imagen, el texto se baja. No quiero eso, quiero que el texto sea normal y luego que la imagen esté donde quepa, ya sea en la página actual o en la siguiente si es demasiado grande.
El MWE sería:
\documentclass{book}
\usepackage[utf8]{inputenc}
\usepackage[margin = 2cm]{geometry}
\usepackage{array}
\setlength{\arrayrulewidth}{1mm}
\setlength{\tabcolsep}{18pt}
\renewcommand{\arraystretch}{1.5}
\usepackage{color}
\newcommand{\compl}[1]{ \textcolor{darkblue}{\textbf{\hl{ #1 }}}}
\definecolor{seccol}{rgb}{0,0.8,0.3}
\usepackage{graphicx}
\begin{document}
In a fully implemented Operating System, any global variables that need to be initialized before they are used, and any library initialization code needs to be called before these libraries cna be used. In our modest project, there are only a couple of libraries, but they need to be initialized nonetheless. Also, the section must be cleared (i.e we must write a 0 to all addresses in the section). All of this is done in the function.
\\
Although very humble in it's current state, if the project is extended so that more functionality is added, this is where we would call any library initialization code, in order to ensure that everything is setup before any function in a library gets called.
\\~\\
The very first thing we want to do is clear the section. Thanks to our, we have a label to indicate exactly where this section begins and another label to indicate exactly where it ends, the script also ensures that all sections of all files get contiguously put together in the final kernel image, so we know that, once we clear this section, all variables that need to be initialized to 0 will contain their correct values. Since the addresses form a continuous block of memory, we can
In a fully implemented Operating System, any global variables that need to be initialized before they are used, and any library initialization code needs to be called before these libraries cna be used. In our modest project, there are only a couple of libraries, but they need to be initialized nonetheless. Also, the section must be cleared (i.e we must write a 0 to all addresses in the section). All of this is done in the function.
\\
Although very humble in it's current state, if the project is extended so that more functionality is added, this is where we would call any library initialization code, in order to ensure that everything is setup before any function in a library gets called.
\\~\\
The very first thing we want to do is clear the section. Thanks to our , we have a label to indicate exactly where this section begins and another label to indicate exactly where it ends, the script also ensures that all sections of all files get contiguously put together in the final kernel image, so we know that, once we clear this section, all variables that need to be initialized to 0 will contain their correct values. Since the addresses form a continuous block of memory, we can
The very first thing we want to do is clear the section. Thanks to our , we have a label to indicate exactly where this section begins and another label to indicate exactly where it ends, the script also ensures that all sections of all files get contiguously put together in the final kernel image, so we know that, once we clear this section, all variables that need to be initialized to 0 will contain their correct values. Since the addresses form a continuous block of memory, we can
\centering
\includegraphics{FramebufferDiagram.png}
\end{document}
Respuesta1
Necesitas poner tu imagen en un figure
entorno para que flote:
\begin{figure}
\centering
\includegraphics{FramebufferDiagram.png}
\end{figure}
Puede agregar un argumento opcional para configurar el posicionamiento. h
para aquí (donde aparece en la fuente), t
para en la parte superior de una página y/o b
para al final de una página ( \begin{figure}[ht]
por ponerlo aquí o, si no cabe, en la parte superior de la página siguiente) .
Nota: su texto sólo ocupa aproximadamente media página. Y como estás usando la book
clase, seguirá alargada hasta que agregues más texto. Esto se debe a que la book
clase intenta que todas las páginas tengan la misma altura.
Editar:
Para evitar estirar la página incluida \raggedbottom
en el preámbulo. LaTeX ya no intentará que todas las páginas tengan la misma altura.
Por cierto: como no desea que la imagen flote, le recomiendo colocar \centering
y \includegraphics
en un grupo ( {...}
). De esta manera el texto después de la imagen ya no quedará centrado. (Supongo que no quieres esto).
Respuesta2
Demasiado largo para un comentario: \raggedbottom
no resuelvo que el uso de \\~\\
en lugar de alínea en blanco (= \par
)dejar una línea en blanco entre párrafos es completamente incorrecto. Sólo estás insertando dos saltos de línea. dentroun párrafo. Incluso entonces, los saltos de párrafo son diferentes y no hay sangría en los párrafos falsos.
Además, colocaste un \centering
antes de finalizar el último párrafo, por lo que no solo se centra la imagen, sino también el último párrafo. La imagen también forma parte del párrafo, y actúa como un personaje enorme, por lo que con algo menos de altura terminará en la misma línea que "...memoria, podemos". En caso contrario pasar a la página siguiente, pero dejando un "agujero" de unos 10 cm. Luego, LaTeX utiliza espacios de goma entre párrafos verdaderos que se estiran para justificar el texto verticalmente. Esto sucederá incluso si la imagen está en un párrafo diferente.
Si desea un espacio fijo entre párrafos, debe usar un comando como:
\setlength{\parskip}{\baselineskip}
Tenga en cuenta que esto no es necesario \raggedbottom
en absoluto porque ahora la hoja de párrafo tiene una longitud fija, no una longitud elástica.
No obstante, suele ser mucho mejor dejar una longitud adaptable (pero igual en todos los párrafos de la página) como:
\setlength{\parskip}{.5em plus .1em minus .1em}
o más simple: use el paquete parskip
en el preámbulo.
En este caso aparentemente esta no es una buena solución porque obligas a Latex a decidir entre un mal y otro (dejas aproximadamente la mitad de la página vacía, o dejas mucho espacio entre párrafos, incluso mucho de lo que quisieras). La solución en este caso, como bien señaló Gustavo Mezzetti, un flotante con opciones h
, t
u p
porque entonces la imagen ya no forma parte de un párrafo normal.
Vale la pena mencionar que un flotante también suele ser preferible porque deja un espacio decente entre la figura y el texto arriba y/o debajo (y permite títulos numerados, lista de figuras, centrar imágenes solas verticalmente, etc.)
MWE sin flotador:
\documentclass{book}
\usepackage[margin=2cm]{geometry}
\setlength{\parskip}{\baselineskip}
\usepackage{graphicx}
\usepackage{kantlipsum} % allow \kant[n] for dummy paragraphs
\begin{document}
\kant[2]\par\kant[1]\par\kant[2]\par\kant[1]\par
\centering
\includegraphics[height=12cm]{example-image}
\end{document}
MWE con flotador:
\documentclass{book}
\usepackage[margin=2cm]{geometry}
\setlength{\parskip}{.5em plus .1em minus .5em}
\usepackage{graphicx}
\usepackage{kantlipsum} % allow \kant[n] for dummy paragraphs
\begin{document}
\kant[2]\par\kant[1]\par\kant[2]\par\kant[1]
\begin{figure}[h]
\centering
\includegraphics[height=12cm]{example-image}
\end{figure}
\end{document}
Nota: \par
(=línea en blanco) ya está implícito en las \kant
macros, pero lo dejo en los MWE para comentar que los párrafos terminan con \par
(y porque los \par adicionales se ignoran, por supuesto).