3

Say I have a book title I want to typeset using latex:

 __________________
|                  |
|   ____________   |
|  |            |  |
|  |            |  |
|  |            |  |
|  |            |  |
|  |   IMAGE    |  |
|  |            |  |
|  |            |  |
|  |            |  |
|  |            |  |
|   ____________   |
|                  |
|                  |
|            Title |
|__________________|

The image is a transparent PNG of an organic subject so you won't actually see a rectangle. The image is just scaled down (from lets say 1500x3000px to however it should be scaled to fit on an 8x10 book cover. The the title goes below the image on the right. I have basically this MWE:

\documentclass[twoside,a4paper,4mm,5mm]{book}

\usepackage[dvipsnames]{xcolor}
\usepackage{fontspec}
\usepackage{titlesec}
\usepackage{fullpage}
\usepackage{geometry}
\usepackage{sectsty}
\usepackage{graphics}
\usepackage{wallpaper}
\usepackage[hidelinks]{hyperref}
\hypersetup{
  colorlinks,
  citecolor=black,
  filecolor=black,
  linkcolor=black,
  urlcolor=black
}

\renewcommand{\contentsname}{Contents}
\setmainfont[Ligatures=TeXReset]{MyMonospaceFont}
\newlength{\characterwidth}
\setmonofont{black}[
  Scale=MatchLowercase
]
\settowidth{\characterwidth}{\normalfont x}
\geometry{
  left=24mm,
  right=24mm,
  top=24mm,
  bottom=40mm,
  footskip=24mm
}
\AtBeginDocument{\raggedright}
\frenchspacing

\makeatletter
\renewcommand\tableofcontents{%
  \@starttoc{toc}%
}
\makeatother

\titleformat{\chapter}[display]
{\filleft\Huge\bfseries\null\vfill\fontsize{8mm}{12mm}\selectfont}
{\thechapter}
{0pc}
{}
[\newpage]

\definecolor{G1}{HTML}{777777}

\newcommand{\ga}[1]{\textcolor{G1}{#1}}

\usepackage{fancyhdr}

\chapterfont{\fontsize{8mm}{12mm}\selectfont}
\sectionfont{\fontsize{4mm}{6mm}\selectfont}
\paragraphfont{\fontsize{4mm}{6mm}\selectfont}

\renewcommand{\c}[1]{\chapter*{#1}\addcontentsline{toc}{chapter}{#1}}
\renewcommand{\l}[1]{\input{#1}}
\newcommand{\s}[1]{\section*{#1}}
\newcommand{\p}[1]{\paragraph*{#1}}
\renewcommand{\t}[2]{
  \begin{titlepage}
    \null\vfill
    \begin{flushright}
    \fontsize{16mm}{24mm}\selectfont #1

    \fontsize{8mm}{12mm}\selectfont #2
    \end{flushright}
    \thispagestyle{empty}
  \end{titlepage}
}
\renewcommand{\o}{\tableofcontents}
\renewcommand{\i}[1]{\includegraphics{#1}}

\pagestyle{fancy}
\fancyhf{}
\renewcommand{\headrulewidth}{0pt}
\renewcommand{\footrulewidth}{0pt}
\fancyhead[RE]{\leftmark}
\fancyhead[LO]{\rightmark}
\fancyfoot[R]{\fontsize{4mm}{6mm}\selectfont \thepage}
\fancypagestyle{plain}{
  \renewcommand\headrulewidth{0pt}
  \fancyhf{}
  \fancyfoot[R]{}
}
\fancypagestyle{empty}{
  \chead{}
  \lfoot{}
  \cfoot{}
  \rfoot{}
}

\begin{document}

% first page is cover of book.

\begin{center}
  \i{img.png}
\end{center}

\begin{titlepage}
  \null\vfill
  \begin{flushright}
  \fontsize{100mm}{120mm}\selectfont #1
  \thispagestyle{empty}
\end{titlepage}

% chapters of book

% back cover of book

How to accomplish this? Ideally it would be possible to do this on a cover and a "back cover" page too :)

9
  • The biggest aspect is how to position the image and the title in the right place.
    – Lance
    Aug 27 '19 at 4:13
  • @LancePollard Please use \begin{picture}...\end{picture} tags for position the image...
    – MadyYuvi
    Aug 27 '19 at 5:04
  • @MadyYuvi please show how, just adding that gives me all kinds of errors.
    – Lance
    Aug 27 '19 at 5:44
  • @LancePollard I meant that you can use the picture environment to position the image in an easy manner, e.g., \begin{picture)(0,0)\put(0,0){\includegraphics{...eps}}\end{picture}, I didn't mean other than this...
    – MadyYuvi
    Aug 27 '19 at 5:52
  • Doing your last comment I end up with this, where it should show a complete figure it only shows a portion, and the title is pushed to page 3 :/ imgur.com/EuZsOXS
    – Lance
    Aug 27 '19 at 7:19
2

Using textpos is a possibility. You place the image in one textblock-environment and title in another and change the the coordinates to suite you.

It is not necessary to define a macro for each element, but it is then easy to change layout if you have many items.

enter image description here

\documentclass[demo]{article}

\usepackage[absolute]{textpos}
\usepackage{graphicx}
\setlength{\TPHorizModule}{1mm}
\setlength{\TPVertModule}{1mm}

\DeclareRobustCommand*{\image}{%
  \begin{textblock}{200}(20,20)
      \includegraphics*[height=200mm, width=160mm]{C:/temp/lisa-simpson.png}%
  \end{textblock}%
  }

\DeclareRobustCommand*{\mytitle}{%
  \begin{textblock}{150}(130,230)
      \Huge\bfseries This is my title%
  \end{textblock}%
  }

\begin{document}

\image
\mytitle

\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.