0

I'm learning how to use Latex and using it to design a pretty simple book. I've made almost everything, but I'm having trouble when I insert a image between some text, I want it on the top of the left page, but when I do it using \begin{figure} it messes my baseline and align the text to the bottom of my margin.

http://romaniar.com.br/img/aleph.png

I've tried the baseline and the gridset package and now i'm just using setspace package. Below is the code I'm using.

\documentclass[9pt, twoside]{book}

\usepackage[showframe]{geometry}

\geometry{
papersize={126mm,189mm},
inner=22.5mm,
outer=22.5mm,
top=13.5mm,
bottom=39.942mm,
}

\usepackage[utf8]{inputenc}
\usepackage[portuguese]{babel}
\usepackage{hyphenat}

\usepackage{float}
\usepackage{graphicx}

\usepackage{fancyhdr}
\usepackage{fontspec}
\setmainfont[Ligatures=TeX, ItalicFont=Typetogether Pollen Regular    Italic.otf,BoldFont=Typetogether Pollen Bold.otf]{Typetogether Pollen Regular.otf}

\pagestyle{fancy}
\fancyhf{}
\fancyfoot
[CO,CE]{\thepage}
\renewcommand{\headrulewidth}{0pt}
\setlength{\footskip}{10mm}

%\usepackage{gridset}
\usepackage{setspace}
%\setlength{\intextsep}{10mm}
\setstretch{1.16}
%\usepackage[fontsize=9.2pt,baseline=5.0058mm]{grid}

\begin{document}

cujas páginas, finalmente, aprendi a cortar, para não comprovar, meses depois, que estavam intactos.
Beatriz Viterbo morreu em 1929; a partir dessa data não deixei passar um 3O de abril sem voltar a sua casa. Eu costumava chegar às sete e quinze e ficar uns vinte e cinco minutos; a cada ano, aparecia um pouco mais tarde e ficava um pouco mais; em 1933, uma chuva torrencial me Na candente manhã de fevereiro em que Beatriz Viterbo morreu, depois de uma imperiosa agonia que não cedeu um só instante nem ao sentimentalismo nem ao medo, observei que os painéis de ferro da praça Constitución tinham renovado não sei que anúncio de cigarros; o fato me desgostou, pois compreendi que o incessante e vasto universo já se afastava dela e que essa mudança era a primeira de uma série infinita.
\begin{figure}[t!]
\centering
\includegraphics[width=81mm,height=81mm]{gradiente1.png}
\vspace*{-10mm}
\end{figure}
Mudará o universo mas eu não, pensei com melancólica vaidade; sei que, alguma vez, minha vã devoção a exasperara; morta, eu podia consagrar -me

Sorry if it's a duplicate, I've tried searching everywhere but didn't make any results

Thanks.

  • Welcome to TeX.SX! You can have a look at our starter guide to familiarize yourself further with our format. – Sean Allred Jun 8 '15 at 2:30
3

Too long for a comment.

  • The base line of the last text line on the second page is correctly aligned with the bottom of the text area. According to \maxdepth, TeX allows the descenders to stick outside the text area to get a proper alignment of the base lines of the last text lines on the pages.

  • The last text line of the first page does not reach the bottom. It should have, because class book sets \flushbottom. Thus you should see an underfull \vbox warning. There is nothing on the page, which can be stretched (or shrunk) to fill the page. \baselineskip does not have the flexibility. It would be the right choice for a grid-based layout, but then the text height should allow a natural number of lines.

  • Option 9pt is not supported by class book. Package extsizes can be used or a better featured class like memoir or scrbook of KOMA-Script.

  • Package fontspec can only be used with LuaTeX or XeTeX, and \usepackage[utf8]{input} should only be used for pdfTeX. LuaTeX and XeTeX already support UTF-8 as characters and do not need \usepackage[utf8]{inputenc}, which takes the bytes of an UTF-8 character to add some support for UTF-8 in 8-bit TeX engines. Because of the special font setting, LuaTeX or XeTeX seems to be required, thus \usepackage[utf8]{inputenc} should be removed.

  • The width of the image is set to 81 mm. Since this is the text width, \linewidth can be used to get rid of the magic numbers:

    \includegraphics[width=\linewidth, height=\linewidth]{gradiente1.png}
    
  • Regarding the top margin: The image is set at the top of the text area, because its height is larger than \topskip. The latter register is used to align the first line (element) on a page. Therefore the base line of the first line in the first page is put with distance \topskip below the upper border of the text area. Usually \topskip is a little higher than the height of A-Za-z to leave room for accented letters. But it can be reduced, if the language is English, for example:

    \settoheight{\topskip}{\normalfont\normalsize M}
    
  • i think you're forgetting (or ignoring) the fact that the first line of a page that is solid text is set at the \topskip distance, not a full baseline. that is the difference here. – barbara beeton Jun 8 '15 at 15:02
  • @barbarabeeton The question is not very clear to me, but I have now added an item about \topskip. – Heiko Oberdiek Jun 8 '15 at 15:21

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.