1

I'm working on an assignment, and I've been working on this specific typographic issue on and off now for two'ish days. Having google'd a lot, read a lot, and tried a lot of the suggestions posted here, I've learned that I'm not the first person searching for an answer to this question, but I haven't managed solve it myself and make the assignment look like anything worth submitting.

What I'm looking for is preferably a way to assign a figure and a figure text to a certain set of pixels at the page and having them stay fixed in place no matter what else might be going on at the page.

What I have made so far looks like this:

\documentclass{article}
\usepackage[utf8]{inputenc}
\usepackage{amsmath}
\usepackage{relsize}
\usepackage{physics}
\usepackage{setspace}
\usepackage{graphicx}
\usepackage{float}
\usepackage{wrapfig}
\usepackage{lipsum}
\usepackage[a4paper, margin={2cm,1.5cm}]{geometry}
\spacing{1.33}

% pictu{picture.png}{right/left}{size}{ref-label}{figure text}
\newcommand{\pictu}[5]{\begin{wrapfigure}{#2}{#350\textwidth}
\includegraphics[width=#350\textwidth]{#1}
\caption{\setstretch{1}\centering\label{#4}#5}
\end{wrapfigure}}

\title{lipsum}
\author{lipsum}
\date{lipsum}
\begin{document}

\maketitle

\section{lipsum mania}
\subsection{subsection 1.1}

\pictu{pic.png}{R}{0.35}{fig:pic1}{figure text.}

Short text here.

\quad
\newline
\lipsum[1]

\subsection{subsection 1.2}

Some more short text here.

\pictu{pic1.png}{L}{0.35}{fig:pic}{Fig text.}

\quad
\newline
\lipsum[1]

\quad
\newline
For some reason the margin set in the beginning doesn't apply to this page... \lipsum[1]

\pictu{picture_related_to_section_1_2.png}{R}{0.35}{fig:pic}{Picture related to subsection 1.2 ... one of which I'd really like to force the placement}

\lipsum[1]

\subsection{Subsection 1.3}

\pictu{picture_with_a_big_fat_unwanted_blank_area_above.png}{R}{0.4}{fig:picx}{Apparently there's a no man's land for text aboce this figure... I assume, it's because the figures are to close, making the program 'think' there's no room for text.}

A bit longer section of short text... which is right now annoying close to the figure text of the misplaced figure.

\lipsum[1]

\subsection{Last subsection so far}

\pictu{picture_related_to_the_last_subsection.png}{R}{0.35}{fig:PnxX}{This picture should preferably be above "Section 2" ... which is it in the code.}

\lipsum[1]

\section{Section 2}

\end{document}

I have included an example of the current typography of a page produced by the code in the end of this novel.

To make the code look cleaner, I made a \newcommand, \pictu, which (to my knowledgde works exactly like just pasting the wrapfig environment each time - neither works ideally though). Feel free to question or correct the code. I'm not looking for fixes - I'm convinced that I'm not anywhere near the right track of a pretty solution. I won't hesitate to abandon this code for something that works.

I've often read that one should just let "LaTex do its thing" and place the figures, where they fit best with the rest of the text, but this has not worked for my case. That's why I initially began to deal with wrapfig.

What I need is to know, if there is a way to force images to remain fixed at specific pixels of the page, or if I have to resign and invest in a Microsoft Office license (I really do want this to work, but so far I'm incapable).

Sorry, for any possible mistakes or lack of knowledge or etiquette regarding my question - I'm new to both latex and to the forum. And if this question has already been answered, do let me know!

And thanks in advance!

Example of the typography: Page 2 of a typographic nightmare.

  • your example has \maketitle in the preamble which generates an error and if you move it after \begin{document} you get an error from \centering mis-used in \caption : ! Undefined control sequence. \\->\let \reserved@e – David Carlisle Jan 6 at 0:42
  • 2
    "What I'm looking for is preferably a way to assign a figure and a figure text to a certain set of pixels at the page and having them stay fixed in place no matter what else might be going on at the page." I would go so far as to say that is not really what LaTeX is for. If you really need that kind of fine control over layout (i mean really need it, not just think you need it) you probably want to invest in some actual serious publishing software, because your application is really not what LaTeX or Microsoft's suite of evil is for – Au101 Jan 6 at 0:44
  • 1
    However, you don't necessarily have to use floats, or let LaTeX place floats only where it wants to, to use LaTeX. There are all kinds of packages to force the floats to come before or after x or y and you should definitely be able to do a decent amount of relative or absolute placement – Au101 Jan 6 at 0:45
  • Thanks in general for the \maketitle correction. @Au101 What do you mean by "not really what LaTex is meant for"? Out of sincere curiosity. LaTex has been presented to me as "the 'everything is possible'-typesetting tool", just a question of will and the right packages. And speaking of: "There are all kinds of packages to force the floats to come before or after x or y", do you by any chance know something I can look for? – juioloiu Jan 6 at 1:37
  • @juioloiu "the 'everything is possible'-typesetting tool". Well, it sort of is. But if you are doing some professional printing and you really want fine control over page layout and the placement of every jot and tittle for artistic reasons say, you really wanna look into graphic design or publishing software, cause that's not really LaTeX's philosophy. LaTeX is more about you get on with writing the writing, I'll take care of laying it out and I'll make it easy to specify high level structures. Separation of form and content, all of that. Macros and so on and so on. – Au101 Jan 6 at 2:07
4

Once you fix the unrelated errors so that you get some pdf output then if you are prepared to put in a small amount of handwork at each figure it is usually possible to control the white space around each figure, for example:

enter image description here

\documentclass[draft]{article}
\usepackage[utf8]{inputenc}
%\usepackage{amsmath}\usepackage{relsize}\usepackage{physics}
\usepackage{setspace}
\usepackage{graphicx}
%\usepackage{float}
\usepackage{wrapfig}
\usepackage{lipsum}
\usepackage[a4paper, margin={2cm,1.5cm}]{geometry}


% pictu{picture.png}[lines]{right/left}{size}{ref-label}{figure text}
\newcommand{\pictu}[6][]{\noindent\begin{wrapfigure}[#1]{#3}{#4\textwidth}
\includegraphics[width=#4\textwidth]{#2}
\caption{\label{#5}#6}
\end{wrapfigure}}

\title{lipsum}
\author{lipsum}
\date{lipsum}

\begin{document}

\begin{spacing}{1.33}

\maketitle
\section{lipsum mania}
\subsection{subsection 1.1}

\pictu[14]{pic.png}{r}{0.35}{fig:pic1}{figure text.}


Short text here.

\indent\lipsum[1]

\subsection{subsection 1.2}

Some more short text here.

\pictu{pic1.png}{l}{0.35}{fig:pic}{Fig text.}


\indent\lipsum[1]


For some reason the margin set in the beginning doesn't apply to this page... 

\indent\lipsum[1]

\pictu[13]{picture_related_to_section_1_2.png}{r}{0.35}{fig:picb}{Picture related to subsection 1.2 ... one of which I'd really like to force the placement}

\indent\lipsum[1]


\subsection{Subsection 1.3}

\pictu[16]{picture_with_a_big_fat_unwanted_blank_area_above.png}{r}{0.4}{fig:picx}{Apparently there's a no man's land for text aboce this figure... I assume, it's because the figures are to close, making the program 'think' there's no room for text.}

A bit longer section of short text... which is right now annoying close to the figure text of the misplaced figure.

\indent\lipsum[1]

\subsection{Last subsection so far}



  Lorem ipsum dolor sit amet, consectetuer
  adipiscing elit. Ut purus elit, vestibulum ut, placerat ac,
  adipiscing vitae, felis. Curabitur dictum gravida mauris. Nam arcu
  libero, nonummy eget, consectetuer id, vulputate a, magna.
\pictu{picture_related_to_the_last_subsection.png}{r}{0.35}{fig:PnxX}{This picture should preferably be above "Section 2" ... which is it in the code.}
  Donec
  vehicula augue eu neque. Pellentesque habitant morbi tristique
  senectus et netus et malesuada fames ac turpis egestas. Mauris ut
  leo. Cras viverra metus rhoncus sem. Nulla et lectus vestibulum urna
  fringilla ultrices.  Phasellus eu tellus sit amet tortor gravida
  placerat. Integer sapien est, iaculis in, pretium quis, viverra ac,
  nunc. Praesent eget sem vel leo ultrices bibendum. Aenean faucibus.
  Morbi dolor nulla, malesuada eu, pulvinar at, mollis ac, nulla.
  Curabitur auctor semper nulla. Donec varius orci eget risus. Duis
  nibh mi, congue eu, accumsan eleifend, sagittis quis, diam. Duis
  eget orci sit amet orci dignissim rutrum.

\section{Section 2}

\end{spacing}
\end{document}

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.