TeX to .pdf

6 views

Steven E. Landsburg

May 24, 2005, 12:01:33 AM5/24/05
to

There must be a standard simple way to do this. I want to
create .tex documents, and then create both .dvi and .pdf
files from the same document. I'll be very grateful for
advice on how to do this.

For those who are interested, here's what *doesn't* work
(although it used to):

For years, I've simply used pdftex. However, pdftex has been
"upgraded" to the point where it is no longer usable in this
way. This is because pdftex no longer uses a configuration
file, but instead requires various parameters to be set in
the .tex document itself. If I set these parametrs, TeX
thinks they're undefined variables; if I don't, pdftex gives
me the wrong page sizes.

If pdftex would allow me to set the parameters at the very
beginning of the document, there would be an easy workaround:
I'd write a .bat file that prepends those settings to the .tex
document before feeding it to pdftex. Unfortunately, pdftex
chokes unless the parameters are set *after* any /magnification
statements in the .tex document, which means that simple
prepending won't work.

If I could simply use the old version of pdftex, that would
anywhere. I still have it installed on my old computer, and
have tried copying over the .exe file and all the relevant
.dll files, but it still won't run. If someone can tell me
how to make it run, or where to download the old version, tht
will solve all my problems.

Steven E. Landsburg

--

Steven E. Landsburg

Donald Arseneau

May 24, 2005, 12:33:07 AM5/24/05
to
land...@troi.cc.rochester.edu (Steven E. Landsburg) writes:

> There must be a standard simple way to do this. I want to
> create .tex documents, and then create both .dvi and .pdf
> files from the same document. I'll be very grateful for
> advice on how to do this.
>
> For those who are interested, here's what *doesn't* work
> (although it used to):
>
> For years, I've simply used pdftex. However, pdftex has been
> "upgraded" to the point where it is no longer usable in this
> way. This is because pdftex no longer uses a configuration
> file, but instead requires various parameters to be set in
> the .tex document itself.

PdfTeX takes its configuration parameters as TeX register
settings, which *can* be set in the main document, but it
*does* read a configuration file. The difference now is that
the file is a TeX input file, and pdftex inputs it. Someone
else can give you accurate details.

> If pdftex would allow me to set the parameters at the very
> beginning of the document, there would be an easy workaround:
> I'd write a .bat file that prepends those settings to the .tex
> document before feeding it to pdftex.

To set parameters in the main TeX file, just test if you are
running pdftex with:

\ifx\pdfoutput\undefined
settings for non-pdftex
\else
settings for pdftex
\fi

To test if you are *producing* pdf output (remember, pdftex can
make dvi) then use package ifpdf.

--
Donald Arseneau as...@triumf.ca

luec...@uark.edu

May 24, 2005, 6:26:19 PM5/24/05
to

Donald Arseneau wrote:
> land...@troi.cc.rochester.edu (Steven E. Landsburg) writes:
>
> > There must be a standard simple way to do this. I want to
> > create .tex documents, and then create both .dvi and .pdf
> > files from the same document. I'll be very grateful for
> > advice on how to do this.
> >
> > For those who are interested, here's what *doesn't* work
> > (although it used to):
> >
> > For years, I've simply used pdftex. However, pdftex has been
> > "upgraded" to the point where it is no longer usable in this
> > way. This is because pdftex no longer uses a configuration
> > file, but instead requires various parameters to be set in
> > the .tex document itself.
>
> PdfTeX takes its configuration parameters as TeX register
> settings, which *can* be set in the main document, but it
> *does* read a configuration file. The difference now is that
> the file is a TeX input file, and pdftex inputs it. Someone
> else can give you accurate details.

pdftex doesn't input the configuration file unless you ask it to, with
\input. In current distributions, this is done in the .ini file that
creates the format:
\input pdftexconfig % in pdflatex.ini and
\input pdftex-dvi % in latex.ini

One could, I suppose, put those in \everyjob to delay the configuration
of parameters to the actual job. But that does not appear to be what
TeX distributions are doing.

Speaking of these files, shouldn't the following line from
texlive2004's pdftex-dvi.tex:
\let\normalpdfhorigin\pdfannot
actually be
\let\normalpdfannot\pdfannot
(following the example of all the rest of that file)?

> > If pdftex would allow me to set the parameters at the very
> > beginning of the document, there would be an easy workaround:
> > I'd write a .bat file that prepends those settings to the .tex
> > document before feeding it to pdftex.
>
> To set parameters in the main TeX file, just test if you are
> running pdftex with:
>
> \ifx\pdfoutput\undefined
> settings for non-pdftex
> \else
> settings for pdftex
> \fi
>
> To test if you are *producing* pdf output (remember, pdftex can
> make dvi) then use package ifpdf.

This was always the best way, even in the old pdftex. It meant that the
setting of parameters could be seen in the actual file.

Dan

Steven E. Landsburg

May 24, 2005, 8:41:07 PM5/24/05
to
Donald Arsenau wrote:

> To set parameters in the main TeX file, just test if you are
> running pdftex with:

> \ifx\pdfoutput\undefined
> settings for non-pdftex
> \else
> settings for pdftex
> \fi

But---and perhaps I am just not understanding something here---
this doesn't seem to be what I'm looking for. Here's why:

I would like to be able to type things like, say,
\magnification=1200, and then have the output be magnified by
120%, regardless of whether I apply TeX or pdftex.

I will have to type several lines, as above. That seems like a
very annoying way to do it.

A much better solution would be to set the pdftex settings, in terms
of, say, true inches, at the very beginning of the document, prior
to the \magnification statement. If I could do this, I wouldn't
have to type the pdftex settings each time; I'd just write a .bat
file called pdftex.bat that prepends these settings and then calls
pdftex.exe . However, pdftex complains about incompatible dimensions
when I try to do this.

What I want to do is create TeX documents, just as I always have,
sometimes with \magnification statements and sometimes without, just
as I always have, and then, at some time in the future, to feed those
documents either to TeX or to pdftex and get the desired output each
time. This seems like it must be something that lots and lots of
people want to do, so I expect there must be some standard easy way
to do it. Again, it worked perfectly with the old pdftex. Isn't
there some way to continue doing it?

Thanks very much for helping.

Steven E. Landsburg

Donald Arseneau

May 24, 2005, 9:53:12 PM5/24/05
to
land...@troi.cc.rochester.edu (Steven E. Landsburg) writes:

> Donald Arsenau wrote:
>
> > To set parameters in the main TeX file, just test if you are
> > running pdftex with:
>
> > \ifx\pdfoutput\undefined
> > settings for non-pdftex
> > \else
> > settings for pdftex
> > \fi

> I will have to type several lines, as above.

No, you said there were some unidentified parameters that have to
be set in pdftex but not in pure TeX, and they have to be set after
any \mag is set. So, use an \if test to conditionally assign those
mystery parameters only when running in pdftex. That's a lot clearer
than script that edits the input file! And if you do want to set
different magnification for pdf, then the conditional test is again
far clearer than some bash script.

--
Donald Arseneau as...@triumf.ca

Laurence Finston

May 25, 2005, 7:30:11 AM5/25/05
to Steven E. Landsburg
On Tue, 24 May 2005, Steven E. Landsburg wrote:

>
> There must be a standard simple way to do this. I want to
> create .tex documents, and then create both .dvi and .pdf
> files from the same document. I'll be very grateful for
> advice on how to do this.
>

I just use 'dvips' and 'ps2pdf' when I want to create PDF files from TeX
output, because I almost always want the PostScript files as well.
However, there's also a 'dvipdf'. 'ps2pdf' and 'dvipdf' are part of
the Ghostscript package.

Laurence Finston

Steven E. Landsburg

May 25, 2005, 9:41:49 AM5/25/05
to
In article <yfi3bsc...@triumf.ca>,
Donald Arseneau <as...@triumf.ca> wrote:

>No, you said there were some unidentified parameters that have to
>be set in pdftex but not in pure TeX, and they have to be set after
>any \mag is set.

This is exactly right.

> So, use an \if test to conditionally assign those
> >mystery parameters only when running in pdftex.

I apologize if I'm being stupid here (and it's quite possible I am),
but this still seems to require me to type several lines of
conditional assignments every time I create a TeX document with
a \mag statement in it. That's what I'm trying to avoid. Have

Laurence Finston

May 25, 2005, 10:00:03 AM5/25/05
to Steven E. Landsburg
On Wed, 25 May 2005 land...@troi.cc.rochester.edu wrote:

>
> Thanks for writing. I'm not sure whether dvips/ps2pdf is a
> solution for me or not, because I'm not sure how dvips handles
> graphics.

dvips supplies commands for including EPS files, e.g.,
'\epsffile'.

> So I'm not sure whether this solves my problem or not, but I'll
> try it. Thanks.

You're welcome.

Laurence

luec...@uark.edu

May 26, 2005, 4:41:22 PM5/26/05
to

Steven E. Landsburg wrote:
> In article <yfi3bsc...@triumf.ca>,
> Donald Arseneau <as...@triumf.ca> wrote:
>
> >No, you said there were some unidentified parameters that have to
> >be set in pdftex but not in pure TeX, and they have to be set after
> >any \mag is set.
>
> This is exactly right.
>
> > So, use an \if test to conditionally assign those
> > >mystery parameters only when running in pdftex.
>
> I apologize if I'm being stupid here (and it's quite possible I am),
> but this still seems to require me to type several lines of
> conditional assignments every time I create a TeX document with
> a \mag statement in it. That's what I'm trying to avoid. Have

How many lines is too much? You can reduce it to one:
\input mypdfconfig

And inside mypdfconfig.tex is
\usepackage{ifpdf} % \input ifpdf.sty for plain tex.
\ifpdf
%pdf settings you used to have in pdftex.cfg
\else
%nothing, as pdftex.cfg didn't affect non-pdf; but
%now you have the flexility to add things here too.
\fi

Now, instead of editing pdftex.cfg, you edit mypdfconfig.tex.

Dan

Donald Arseneau

May 27, 2005, 10:52:59 PM5/27/05
to
land...@troi.cc.rochester.edu (Steven E. Landsburg) writes:

> In article <yfi3bsc...@triumf.ca>,
> Donald Arseneau <as...@triumf.ca> wrote:
>
> > So, use an \if test to conditionally assign those
> > >mystery parameters only when running in pdftex.
>

> but this still seems to require me to type several lines of
> conditional assignments every time I create a TeX document with
> a \mag statement in it. That's what I'm trying to avoid. Have

Perhaps, perhaps not, but that statement doesn't match how I viewed
the situation. Every document? Not just a few unusual documents?

If a document is to be treaded differently for postscript and pdf,
then the condional assignments should be explicitly shown in the
document, or else it is a great source of confusion.

If the problem is instead that pdflatex configuration absolutely
prohibits \mag setting, then let's hear specifics.

--
Donald Arseneau as...@triumf.ca

Steven E. Landsburg

May 31, 2005, 9:44:20 PM5/31/05
to
In article <yfibr6w...@triumf.ca>,
Donald Arseneau <as...@triumf.ca> wrote:

>If a document is to be treaded differently for postscript and pdf,
>then the condional assignments should be explicitly shown in the
>document, or else it is a great source of confusion.

I don't see why you say this. I have a .tex document called
foo.tex . At some time in the future, I want to issue the
command "tex foo" and get a .dvi file. At some other time in
the future, I want to issue the command "pdftex foo" and get
a .pdf file. And I want the .dvi file and the .pdf file, when
viewed, to look identical.

Since the ultimate output is intended to look identical, I don't
see why the document should distinguish between them.

>
>If the problem is instead that pdflatex configuration absolutely
>prohibits \mag setting, then let's hear specifics.

Sure. Here are some specifics:

1) If foo.tex looks like this:

\magnification=1200
Hello, World.
\bye

then the .dvi file and the .pdf file don't look the same; the .pdf
file looks like a shrunken version of the .dvi file. So that's no
good.

2) If foo.tex looks like this:

\pdfpageheight=8.5 truein
\pdfpagewidth=11 truein
\magnification=1200
Hello, World.
\bye

then pdftex complains about "incompatible magnification". So that's
no good.

3) If foo.tex looks like this:

\magnification=1200
\pdfpageheight=8.5 truein
\pdfpagewidth=11 truein
Hello, World.
\bye

then pdftex works. Tex, on the other hand, complains about undefined
variables, but of course I can fix that with an \if\pdfoutput=....
statement. HOWEVER, this is still no good for two reasons:

a) it requires typing extra code every time I start a document
with a \magnification statement (yes, I realize I can reduce
it to one line by calling an input file, but it's still extra
code I'd rather not type

b) More importantly, I have hundreds of already-existing documents
that I still occasionally TeX and distribute, or pdftex and
distribute, and all of those documents would have to be laboriously
fixed up.

So that's no good, really.

Again, the goal is very simple: I've got lots of existing TeX documents.
I want to be able to apply pdftex to them and get pdf output that looks
just like the dvi output.

Prepending code (a la solution 2 above) is fine, since I can write a
.bat file to do that. Unfortunately, as noted above, prepending code
doesn't work. (It would work if I used inches instead of true inches,
but that's also no good, since some of my documents are magnified and
others aren't.)

I hope I have made the question clearer and clarified why the suggestions
I've gotten so far aren't exactly what I'm looking for, though I do
very much appreciate the attempts.

Steven E. Landsburg

A
A
A
A

Donald Arseneau

Jun 1, 2005, 2:06:44 AM6/1/05
to
land...@troi.cc.rochester.edu (Steven E. Landsburg) writes:

> In article <yfibr6w...@triumf.ca>,
> Donald Arseneau <as...@triumf.ca> wrote:
>
> >If a document is to be treaded differently for postscript and pdf,
> >then the condional assignments should be explicitly shown in the
> >document, or else it is a great source of confusion.
>
> I don't see why you say this.

Because it makes sense, ... but ...

> I want the .dvi file and the .pdf file, when
> viewed, to look identical.

... but it doesn't apply to you. I was thinking you wanted different
formats for each.

> Sure. Here are some specifics:

I think I'm getting my little brane wrapped around the situation, maybe.

> \pdfpageheight=8.5 truein
> \pdfpagewidth=11 truein
> \magnification=1200
> Hello, World.
> \bye
>
> then pdftex complains about "incompatible magnification". So that's
> no good.

This is an error in any TeX: Page 60 TeXbook: \mag is examined when
computing a true dimension; \mag cannot be changed after it is examined.

Furthermore, it wouldn't work even if TeX didn't flag the error! The
magnification is used to compute "in" from "truein" when the assignment
is made, so the parameters would not adjust to a new mag later. This
is much like font-based units like "em" -- the conversion happens at
the assignment, not at the time of use.

The same restrictions apply to \hsize and \vsize, so they are assigned
with "in" in plain.tex; then, in the \magnification macro (\m@g),
they are assigned again using "truein". I suggest you work the
\pdf-media-size settings the same way, by setting them in \m@g...

In pdftex.ini(?) before \dump, insert

\catcode`@=11
\edef\m@g{\m@g\pdfpagewidth8.5truein\pdfpageheight11truein}
\catcode`@=12

(Note portrait orientation, reversed from yours.) Then update
formats.

This makes sense for general distribution too. Is there a pdftex mailing
list?

I suspect what "worked" in old versions of pdftex was it may have left
the media parameters unassigned, and they defaulted to letter paper.
Who knows?

> 3) If foo.tex looks like this:
>
> \magnification=1200
> \pdfpageheight=8.5 truein
> \pdfpagewidth=11 truein
> Hello, World.
> \bye
>
> then pdftex works. Tex, on the other hand, complains about undefined
> variables, but of course I can fix that with an \if\pdfoutput=....
> statement. HOWEVER, this is still no good for two reasons:
>
> a) it requires typing extra code every time I start a document
> with a \magnification statement (yes, I realize I can reduce
> it to one line by calling an input file, but it's still extra
> code I'd rather not type
>
> b) More importantly, I have hundreds of already-existing documents
> that I still occasionally TeX and distribute, or pdftex and
> distribute, and all of those documents would have to be laboriously
> fixed up.

Both of these are handled by modifying the \magnification macro. The
modification fits thematically with what plain TeX already must do with
\hsize and \vsize.

--
Donald Arseneau as...@triumf.ca

luec...@uark.edu

Jun 1, 2005, 5:49:37 PM6/1/05
to

Donald Arseneau wrote:

>
> I suspect what "worked" in old versions of pdftex was it may have left
> the media parameters unassigned, and they defaulted to letter paper.
> Who knows?

It actually didn't work consistently across distributions. All pdftexs
consulted pdftex.cfg when loaded. Page sizes there could be in true
units or regular units. In some distributions (e.g., miktex) these true
units were divided by \mag and the smaller units written into the pdf
file. This is correct behavior for normal TeX and normal dimensions
with respect to the dvi file, since the dvi driver was supposed to
apply \mag to all dimensions and the true size would result. But pdftex
acts as its own dvi driver and should therefore have multiplied by \mag
when writing the pfd file. This was discussed at the time and it was
generally thought that miktex was buggy and tetex got it right.

As to when the values of pdftex.cfg were applied, I assume it happened
at the output of the first page, given that this worked, but also
because \pdf... commands tended to be treated like \specials.

Dan

Donald Arseneau

Jun 2, 2005, 1:43:00 AM6/2/05
to
luec...@uark.edu writes:

> It actually didn't work consistently across distributions. All pdftexs
> consulted pdftex.cfg when loaded. Page sizes there could be in true
> units or regular units.

If it performs a "true" units assignment upon loading, then it breaks
all ability to magnify. That is why plain TeX sets hsize and vsize
in unadorned "in" units in plain.tex.

> acts as its own dvi driver and should therefore have multiplied by \mag
> when writing the pfd file.

Yes, a pdftex should write "true" units unscaled to the pdf output, but
scale everything else according to the magnification, unless it can
write a "magnification factor" separately to the pdf, in which case
it can follow regular TeX's method.

--
Donald Arseneau as...@triumf.ca