3

I want to use Helevetica Neue for producing a dvi file. As this means using a standard system (non LaTex) font, this leave LuaTeX as the only option.

I’m simply using something like this:

\photo{/Users/example/Pictures/identité0001.jpg}

This works nice when using XeTex for any output and even with LuaLateX too in pdf mode.
But if I use dvi mode then it fails:

(/usr/share/texlive/texmf-dist/tex/latex/microtype/mt-mvs.cfg
File: mt-mvs.cfg 2006/07/05 v1.1 microtype config. file: Marvosym Euro (RS)
)
\makecvheadpicturebox=\box62
! String contains an invalid utf-8 sequence.
<read 0> 
   ���xxExif

Where of course Exif means the problem is the binary data of the image.

The man page is maybe spotting the reason why:

All LuaTeX text input and output is considered to be Unicode text.
In DVI mode, luaTeX can be used as a complete replacement for the TeX engine.
In PDF mode, luaTeX can natively handle the PDF, JPG, JBIG2, and PNG graphics formats. luaTeX cannot include PostScript or Encapsulated PostScript (EPS) graphics files; first convert them to PDF using epstopdf (1).

Which hints it doesn’t supports the image format.
If yes, what image format I should use? and how to convert the picture to that image?

Or is there a way to convert directly Extended dvi (.xdv) files produced by XeLaTex to plain dvi files?

7
  • Welcome to TeX.SE! Can I ask why you want to obtain a dvi file? The image will not be shown in the dvi, only when you convert it to .pdf afterwards the image will re-appear.
    – Marijn
    Commented Jun 1, 2020 at 18:22
  • @Marijn because I want to let using dvi viewers and other reason which makes proposing a file in the dvi format makes I know what LaTeX is which is important in my branch. Commented Jun 1, 2020 at 18:29
  • Maybe use \usepackage[demo]{graphicx}? Then the images are not actually included and dvilualatex doesn't complain. See also tex.stackexchange.com/questions/124049/… for setting thios option if the class loads the package.
    – Marijn
    Commented Jun 1, 2020 at 18:32
  • @Marijn I still want the picture embedded in the output file. Currently (as you can see in the question) I’m simply using /photo provided by moderncv. Commented Jun 1, 2020 at 18:41
  • Do you want to embed the image even if you don't see it? The dvi viewer will not show .jpg images. Of course if you want to produce a pdf from the dvi afterwards then you need the image data, but in that case you can also make a separate direct-to-pdf version without the demo option. The only use case would be if you want other people to create a pdf from a dvi file that you provide - but that seems a bit of an edge case.
    – Marijn
    Commented Jun 1, 2020 at 18:43

1 Answer 1

6

The first thing you have to understand about the DVI format is that it's pretty simple and does not have integrated support for many features we expect from formats like PDF. Especially there are no integrated commands for including images.

There is a command which allows for extensions though which corresponds to TeX's \special primitive. This allows to directly pass commands to the program interpreting the DVI file, for example the command to include an image. There are multiple formats for these commands though, so you have to specify which "backend" to use. The right choice depends on the program you want to use the DVI file with. This also means that the TeX engine only passes along this option and never actually reads or interprets your image file, so there is no concept "supporting" an image format on this level. (Effectively you instead need your DVI viewer/converter/etc. and the TeX macos which write the \special to support your image format. In practice, this means that you need an EPS image) To specify this backend, pass an option to the package xcolor, for example by adding (for dvipdfmx)

\PassOptionsToPackage{dvipdfmx}{graphicx}

or by adding the dvipdfmx class option. (The last option also sets the backend for geometry, color, and other packages, so it is often more reliable.) If you do not do this, the dvips backend is the default.

So if you set the right backend and have the image in the right (aka EPS) format, you can just use it to create the DVI file:

%% Copyright 2006-2015 Xavier Danaux ([email protected]).
%
% This work may be distributed and/or modified under the
% conditions of the LaTeX Project Public License version 1.3c,
% available at http://www.latex-project.org/lppl/.

\documentclass[11pt,a4paper,sans]{moderncv}% For dvips
%\documentclass[11pt,a4paper,sans,dvipdfmx]{moderncv}% For dvipdfmx
%\documentclass[11pt,a4paper,sans,dvisvgm]{moderncv}% For dvisvgm
\moderncvstyle{casual}
\moderncvcolor{blue}
\usepackage[scale=0.75]{geometry}
\name{John}{Doe}
\title{Resumé}
\photo[64pt][0.4pt]{example-image}
\begin{document}
\makecvtitle
\end{document}

This will give you a DVI file, but you will encounter another issue: You use native system fonts instead of regular TFM based TeX fonts. As of TeXLive 2020, none of the included programs can deal with DVI files referencing native system fonts. (This is about to change: dvisvgm will support system font in DVI files written by LuaTeX soon (aka starting with TeXLive 2021).

Also the image is only references by path, no DVI backend I know about supports embedding the image.

6
  • Do you mean the dvi format doesn t support displaying picture even with referring an external file? Or does it can accept .ps pictures? Commented Jun 1, 2020 at 21:40
  • I throught dvi could embedded PostScript images. Is is wrong? Commented Jun 1, 2020 at 21:42
  • @user2284570 There is no built-in command for displaying any pictures, but there are extensions (specials) allowing to insert ps pictures which are understood by basically any program interpreting DVI files. These always use external paths though. Commented Jun 1, 2020 at 21:48
  • @user2284570 Some DVI viewers load PostScript files to display them in place, but DVIs are not self-contained: that's one reason people have moved to PDF
    – Joseph Wright
    Commented Jun 2, 2020 at 6:23
  • When Knuth first wrote TeX, none of the current graphics formats even existed (except possibly GIF). Commented Jun 2, 2020 at 14:15

You must log in to answer this question.

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