2

I am using tex4ebook to convert a memoir class document into epub. The document has several images included thru \includegraphics{}. The images are saved as .eps in the same folder as the .tex file. I also have the graphics.4ht file in the same folder. The epub is generated with following issues:

  1. The file name of image appears before the image itself (see screenshot)
  2. Though I have given the option [width=\textwidth], the image appears shrunk

Couple of additional issues:

A1) Though I have set title{} and author{} in the preamble, both are missing from the epub

A2) I want to include endnotes that appear as a chapter at the end of the book, preferably split into chapters, and also hyperlinked to be displayed as a popup in the reader by clicking the endnotemark in the main body. In the PDF version, I am able to get all this (including the PDF version of hyperlinked notes and notemarks) using \postnote. In the epub with tex4ebook, I am able to get the second part (popup of endnote in the ereader - see second screenshot) by using \footnote. Is there a way to get the first part also - get all the notes printed as a end of book chapter as part of backmatter?

Very much appreciate guidance on:

  1. How to prevent the filename from appearing in the epub

  2. How to ensure that image in epub is scaled to width of text in the reader

I am using MacTex (Tex Live Utility 1.54 and have checked that packages are up to date as of this writing). So far, checking of epub output has been on iBooks in Mac. Yet to check on an ereader.

Here is the MWE based on the original book.

Thanks so much in advance for any help in resolving these issues.

File name of image  appears right next to image

How the foot note appears


\documentclass[demyvopaper, openany, 10pt]{memoir}
\usepackage{tex4ebook} % FOR EPUB CONVERSION
\linespread{1.15}
\settocdepth{chapter}
\usepackage{anyfontsize}
\usepackage{charter}
\usepackage[T1]{fontenc}
\usepackage{textcomp}
\usepackage[british]{babel}
\usepackage[setpagesize=false, hidelinks]{hyperref}
\usepackage{xurl} % WORP WRAP LONG URLS
\usepackage{graphicx}  % TO EMBED IMAGES
\usepackage[format=hang,]{caption}
\captionsetup{justification   = raggedright,
              singlelinecheck = false}
\captionsetup{labelfont={sc}}
\captionsetup{font={bf}}
\newcommand{\source}[1]{\caption*{\raggedright{\fontsize{7}{8}\selectfont{\normalfont{Source: {#1}}}}} } % TO ADD "Source" TO FIGURES LEFT-ALIGNED, FONT SIZE 7

\usepackage{longtable} %
\usepackage{afterpage} % START LONGTABLE AT TOP OF NEXT PAGE
\usepackage{enumitem, amssymb} % LISTS INSIDE TABLE

\newlength\mylength % CENTERED COLUMN {C {WIDTH}}
\newcolumntype{C}[1]{>{\centering\arraybackslash}p{#1}}

\newlist{myitemize}{itemize}{1} 
\setlist[myitemize]{label={--},nosep,leftmargin=*} % CUSTOM LIST INSIDE TABLE

\newlist{todolist}{itemize}{2} % CUSTOM LIST FOR CHECKBOX
\setlist[todolist]{label=$\square$}
\usepackage[skins]{tcolorbox} % RESPONSE BOX FOR BR-TOOL

\usepackage{etoolbox} % TO USE AtBeginEnvironment
\AtBeginEnvironment{longtable}{\fontsize{8}{8}\selectfont\fontfamily{phv}\selectfont} % ADJUST FONT SIZE & FAMILY IN LONG TABLES

\usepackage{lscape} % FOR LANDSCAPE ENVIRONMENT
\usepackage{rotating}
\setlength{\textfloatsep}{0.15in} % SPECIFY SPACE BETWEEN TEXT AND FLOATS

\usepackage{ragged2e} %TO ALIGN TEXT IN BOXES 
\usepackage{setspace} % TO CHANGE LINE SPACING
\usepackage{framed} % FOR TEXT IN BOXES

\def\hyph{-\penalty0\hskip0pt\relax} % FORCED HYPHENATION OF WORDS

\usepackage{lipsum}

\title{MWE}
\author{Author name}
\date{}

% MAIN CONTENT
\begin{document}

\chapter*{Chapter Title 01}

\lipsum{1-2}

% INSERT FIGURE 1.1 HERE 
\afterpage{
\begin{figure}[thp]
  \begin{center}
  \includegraphics[width=\textwidth]{fig0101}
  \end{center}
  \source{This figure was sourced from the internet\footnote{\url{https://people.sc.fsu.edu/~jburkardt/data/eps/eps.html}}}
  \caption{Petersen graph}
  \label{labfig0101}
\end{figure}
}

\lipsum{3-4}

%\backmatter

%\printpagenotes

\end{document}

1 Answer 1

1

I am not sure why you get the image name in your output. I cannot reproduce that with your MWE.

The other issues can be fixed easily:

ad 2) you use small page size, so the width assigned to your image is small. You can use the following configuration file, config.cfg to use the natural image size instead:

\Preamble{xhtml} 
\Configure{Gin-dim}{} 
\Css{img { 
    max-width: 100\%; 
    height: auto; 
}} 
\makeatletter
\let\Author\@author
\makeatother
\begin{document} 
\EndPreamble

Compile using:

$ tex4ebook -c config.cfg filename.tex

If you want to resize it to the reader width, replace max-width with width.

ad A1) you need to use the \maketitle in your document for \author and \title to have any effect.

ad A2) try the fn-in option. It puts footnotes at the end of the current page. You can request it using:

$ tex4ebook -c config.cfg filename.tex "fn-in"

This is the result:

enter image description here

enter image description here

7
  • Thanks so much michal.h21. The config.cfg file and 'fn-in" work beautifully. \maketitle sets the book title but not the author's name. Re the image file name appearing next to image: Since you are not getting the filename with the MWE, let me try generating the epub in a different computer and revert.
    – SPRIyer
    May 29 at 8:45
  • the 'fn-in" puts all footnotes in a chapter at the end of the chapter. Is there another option that would place all footnotes at the end of the book, after all chapters? Thanks.
    – SPRIyer
    May 29 at 8:47
  • @SPRIyer for the end notes, you can try the Enotez package. I've added the support for that recently.
    – michal.h21
    May 29 at 13:54
  • @SPRIyer you are right, the author name is missing. It seems to be an issue between TeX4ht and Memoir. It is set correctly when I use the Book class.
    – michal.h21
    May 29 at 14:13
  • @SPRIyer I've fixed the issue with author in the config file, see the updated answer.
    – michal.h21
    May 29 at 15:02

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .