2

I would like to place a figure at the left of a page without any margin left. I have been testing the following:

\documentclass[a4paper,12pt]{book}
\usepackage[utf8]{inputenc}
\usepackage[spanish]{babel}
\usepackage{graphicx}
\usepackage{geometry}
\usepackage{fancyhdr}
\usepackage{listings}
\usepackage[absolute]{textpos}
\setlength{\TPHorizModule}{1mm}
\setlength{\TPVertModule}{1mm}
\textblockorigin{0mm}{0mm} % start everything near the top-left corner
\newcommand{\HRule}{\rule{\linewidth}{0.5mm}}

\begin{document}
\thispagestyle{empty}
\newgeometry{left=0in,right=0in,top=0in,bottom=0in,bindingoffset=0in}
   %--\begin{textblock}{⟨hsize ⟩}(⟨hpos ⟩,⟨vpos ⟩)
   \begin{textblock}{3.5}(-1,1)
      \includegraphics{teleco/ETS35.pdf}
    \end{textblock}

\textblockorigin{30mm}{30mm}
\begin{textblock}{158}(10,15)   
\begin{center}
\HRule \\[0.6cm]
{ \huge \bfseries Network Management:}\\[0.4cm]
{\huge \bfseries A practical Approach} \\[0.4cm]
\HRule \\[2.0cm]

\begin{figure}[htbp]
    \centering
        \includegraphics[height=2.5in]{teleco/internet.png}
    %\caption{caption}
    \label{fig:Desktop_2014-12-02-networks-640x512}
\end{figure}
\vspace{2.75cm}
{\Large \bfseries John Smith}\\[0.4cm]
{\Large \bfseries Departamento de Tecnologías de la Información y las Comunicaciones}\\[1.5cm]
{\LARGE \bfseries E.T.S.I.T}\\[0.5cm]
{\LARGE \bfseries TECHNICAL UNIVERSITY OF \\[0.15cm] CARTAGENA}\\[0.75cm]
\vfill {
}
\end{center}
\end{textblock}
\end{document}

Which compiles a page similar to this:

page-no-margin

that has a left image with blank spaces to the left and up and the bottom of it. I would like to place that left (long) image filling those margins.

How could I make it?. Thank you.

2

The problem you identify is caused by a combination of the first textblock setting being {3.5}(-1,1) and the default \parindent setting of 6pt. (-1,1) moves the origin of the image placement 1mm to the left and 1mm down from the \textblockorigin, which is in the top left corner at (0,0). This, combined with the addition of 6bp in the x-direction because of \parindent is offsetting your image.

I suggest there isn't any need to use \newgeometry or relocate the \textblockorigin. Eliminating this code keeps the logic of your layout consistent throughout the code.

So:

  1. Add \setlength\parindent{0pt}
  2. Delete %\newgeometry{left=0in,right=0in,top=0in,bottom=0in,bindingoffset=0in}
  3. Delete %\textblockorigin{30mm}{30mm}
  4. Change \begin{textblock}{3.5}(-1,1) to \begin{textblock}{1}(0,0) to place example-image-A at the top left corner
  5. Change \begin{textblock}{158}(10,15) to \begin{textblock}{158}(40,45), which positions the text and example-image-B, without relocating the \textblockorigin.

EDIT OP indicated subsequently that the left hand image did not extend the full pageheight. To ensure the image extends the entire paperheight, we must use height=1.0\paperheight as an option to \includegraphics. To show page borders and demonstrate that the image extends the full page height, I added OP's images and a border using TikZ. This is on the background layer so that the image and text placed using the testpos boxes overwrites the border. This required adding overlay to the class options for the textpos package.

This is the result:

enter image description here

This is the MWE:

\documentclass[a4paper,12pt]{book}
\usepackage[utf8]{inputenc}
\usepackage[spanish]{babel}
\usepackage{graphicx}
\usepackage{tikz}
\usepackage{geometry}
\usepackage{fancyhdr}
\usepackage{listings}
\usepackage[absolute,overlay]{textpos}
\setlength{\TPHorizModule}{1mm}
\setlength{\TPVertModule}{1mm}
\textblockorigin{0mm}{0mm} % start everything near the top-left corner
\newcommand{\HRule}{\rule{\linewidth}{0.5mm}}
\setlength\parindent{0pt}

\usetikzlibrary{backgrounds}
\pgfdeclarelayer{background}
\pgfsetlayers{background,main}

\begin{document}
\thispagestyle{empty}

\begin{tikzpicture}[remember picture,overlay]
\begin{pgfonlayer}{background}
\draw[line width=3mm,red!50] (current page.north west) rectangle (current page.south east);
\end{pgfonlayer}
\end{tikzpicture}

%\newgeometry{left=0in,right=0in,top=0in,bottom=0in,bindingoffset=0in,showframe}
   %--\begin{textblock}{⟨hsize ⟩}(⟨hpos ⟩,⟨vpos ⟩)
   \begin{textblock}{1}(0,0) % was {3.5}(-1,1)
      \includegraphics[width=3cm,height=1.0\paperheight]{ETS35}
    \end{textblock}

%\textblockorigin{30mm}{30mm}
\begin{textblock}{158}(40,45)   % was {158}(10,15)
\begin{center}
\HRule \\[0.6cm]
{ \huge \bfseries Network Management:}\\[0.4cm]
{\huge \bfseries A practical Approach} \\[0.4cm]
\HRule \\[2.0cm]

\begin{figure}[htbp]
    \centering
        \includegraphics[height=2.5in]{internet}
    %\caption{caption}
    \label{fig:Desktop_2014-12-02-networks-640x512}
\end{figure}
\vspace{2.75cm}
{\Large \bfseries John Smith}\\[0.4cm]
{\Large \bfseries Departamento de Tecnologías de la Información y las Comunicaciones}\\[1.5cm]
{\LARGE \bfseries E.T.S.I.T}\\[0.5cm]
{\LARGE \bfseries TECHNICAL UNIVERSITY OF \\[0.15cm] CARTAGENA}\\[0.75cm]
\vfill {
}
\end{center}
\end{textblock}
\end{document}
  • Thanks. The changes avoid the spaces except for the bottom one. I can give a link to my figure dropbox.com/sh/b2jn511hquxjhsx/AABVffqJNPX6v7NW9vKzSxnva?dl=0 if you can test it. – user1993416 Sep 21 '17 at 14:34
  • Besides, after this page, how can I set the page margins to regular sizes? – user1993416 Sep 21 '17 at 14:55
  • Sorry for the precedent comments; the figure fills the height of the page. The solution is perfect. Thanks – user1993416 Sep 21 '17 at 15:14
  • Ok. I updated the example to show the image extending to the borders. Here, you call geometry, but no margins are set. You could apply margins and everything on the title page would remain intact because you are using textpos to place all the page elements. It operates independent of the margins. If you are having trouble, you can ask another question that illustrates the problem. – Ross Sep 21 '17 at 15:27

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.