8

The structure of the DVI file format is documented by Donald Knuth in TEX: the Program, Addison-Wesley, 1986.

Although PDF is the primary output format, LuaTeX can also output DVI files. Are these DVI files different from what is found in the original specification?

XeTeX can output XDV files, which are an extension of the DVI format. Is the XDV format documented anywhere?

2
  • 1
    for luatex it is as far as I know standard dvi, for xetex I think it's just documented in the web sources of xetex (which is the equivalent of tex-the-program) but a good question, this ought to be easier to find. Dec 12, 2015 at 12:12
  • Good documentation for the structure of the DVI file format is also found in Knuth's dvitype program (texdoc dvitype), with relevant parts of it (somewhat unnecessarily IMO) duplicated in “The DVI Driver Standard, Level 0”. May 8, 2017 at 6:55

1 Answer 1

6

I think luatex generated dvi is standard.

For xdv, xetex.web defines the extended format, the relevant parts being

\yskip\noindent Commands 250--255 are undefined in normal \.{DVI} files, but
the following commands are used in \.{XDV} files.

\yskip\hang\vbox{\halign{#&#\hfil\cr
|define_native_font| 252 & |k[4]| |s[4]| |flags[2]| |l[1]| |n[l]| |i[4]|\cr
& |if (flags and COLORED) then| |rgba[4]|\cr
& |if (flags and EXTEND) then| |extend[4]|\cr
& |if (flags and SLANT) then| |slant[4]|\cr
& |if (flags and EMBOLDEN) then| |embolden[4]|\cr
}}

\yskip\hang|set_glyphs| 253 |w[4]| |k[2]| |xy[8k]| |g[2k]|.

\yskip\noindent Commands 250 and 255 are undefined in normal \.{XDV} files.

@ @d set_char_0=0 {typeset character 0 and move right}
@d set1=128 {typeset a character and move right}
@d set_rule=132 {typeset a rule and move right}
@d put_rule=137 {typeset a rule}
@d nop=138 {no operation}
@d bop=139 {beginning of page}
@d eop=140 {ending of page}
@d push=141 {save the current positions}
@d pop=142 {restore previous positions}
@d right1=143 {move right}
@d w0=147 {move right by |w|}
@d w1=148 {move right and set |w|}
@d x0=152 {move right by |x|}
@d x1=153 {move right and set |x|}
@d down1=157 {move down}
@d y0=161 {move down by |y|}
@d y1=162 {move down and set |y|}
@d z0=166 {move down by |z|}
@d z1=167 {move down and set |z|}
@d fnt_num_0=171 {set current font to 0}
@d fnt1=235 {set current font}
@d xxx1=239 {extension to \.{DVI} primitives}
@d xxx4=242 {potentially long extension to \.{DVI} primitives}
@d fnt_def1=243 {define the meaning of a font number}
@d pre=247 {preamble}
@d post=248 {postamble beginning}
@d post_post=249 {postamble ending}

@d define_native_font=252 {define native font}
@d set_glyphs=253 {sequence of glyphs with individual x-y coordinates}
5
  • Thanks David! Where can I find xetex.web? I'll wait a little bit to accept your answer in case you or anyone else can get a definitive confirm on LuaTeX dvi. Surely it must have some additional font commands since it deals with OpenType..?
    – akvilas
    Dec 12, 2015 at 14:36
  • 2
    @akvilas there is a copy here tug.org/svn/texlive/trunk/Build/source/texk/web2c/xetexdir Dec 12, 2015 at 15:58
  • 1
    @akvilas the source for luatex is in a parallel directory so you could look around for any dvi extensions. I don't thhink there are any (I don't think it needs any for fonts it just references font by name, the dvi driver needs to know externally if it is opentype or type1 or pk font the dvi file doesn't have that information. Dec 12, 2015 at 16:00
  • Great! One more thing - What is a .web file and how can I typeset it? Looks like plain tex, but the compiler complains at certain odd constructs. And part of the reason of why I expected a modified dvi for LuaTeX is that certain OpenType glyphs have no character encoding. For instance, the display version of big math operators. How are these glyphs defined in the dvi?
    – akvilas
    Dec 12, 2015 at 19:37
  • 1
    @akvilas Tex is written as a "literate" program in Knuth's system WEB it is the source of the tex program (essentially a variant of PASCAL), but also the source of the tex-the-program book as web can be converted also to tex. these days web is converted to C for compilation hence web2c that you see in many tex related programs. (technical q about dvi, I have no idea:-) Dec 12, 2015 at 20:00

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.