# [OS X TeX] documentation on programming language (in macros)?

Roger Hart rhart at mail.utexas.edu
Sat Feb 26 00:31:37 EST 2005

On Feb 25, 2005, at 2:06 AM, Bruno Voisin wrote:

> Le 25 févr. 05, à 08:15, Roger Hart a écrit :
>
>> So I was wondering if it would be difficult to get ps4pdf to work
>> under xelatex? I've become very dependent on ps4pdf.  I did look at
>> the file, but I'm afraid I'm not expert enough to really understand
>> what it is doing, or how to alter it to produce the same result with
>> xelatex. I would be indeed very grateful for any suggestions.
>
> I've looked at this and managed to get ps4pdf.sty bypass its hardwired
> \RequirePackage[pdftex]{graphicx},

[....]

> I won't be able to spend more time on this, but in any case that
> doesn't look good.

I certainly very much appreciate all the extremely generous and expert
help that I've received with my many very ignorant and simple novice
more, and I do hope I may forgiven for stating this, since I really
don't know anything about programming in TeX and LaTeX at this point,
but it seems to me that making ps4pdf work with xelatex should be
pretty trivial exercise:

1)  add a section of code that tests to see if the environment is
xelatex, and if it is, use \XeTeXpdffile, instead of the corresponding
pdflatex command, to insert the contents of myfilename-pics, one page
at a time;

2) if the environment is not xelatex, then process according to ps4pdf,
either creating a -pics file under latex + dvips +ps2pdf, and even
allowing the usual processing under pdflatex.

That is, something like,

case of xelatex {
%set definitions
\newcounter{pdfpage}
\setcounter{pdfpage}{1}
%redefine ps4pdf for xelatex
\renewcommand{ps4pdf}{
\XeTeXpdffile "scratch-xy-pics.pdf" page pdfpage
\stepcounter{pdfpage}
}
}
case of latex + dvips +ps2pdf {
process what is already in ps4pdf
}
case of pdftex{
process what is already in ps4pdf
}

Or even,

if xelatex {
insert pages as above
}
else
\usepackage{ps4pdf}
endif

Obviously, as you can see from the above, I know nothing about the
syntax or commands of macros.  But I'm growing frustrated enough with
macros and other things that don't work with CJK that it seems about
time I learn.  So my question is, where is all of this language
documented? I tried imitating some .sty files just to find a test for
xetex, but I was unable to get any of the conditional loops to do what
I want. I have all of the LaTeX books, and none of them document
commands like \if ... \fi, \group ... \endgroup, etc. that are used in
macro commands.I didn't see any documentation on the web.

Is this TeX, documented in Knuth's TeXbook? If so, I'll purchase it
right away. It seems like I would learn a lot by completing this
exercise, even if it is indeed as trivial as I assume.

Please let me know what the best and most comprehensive source is so I
can begin to write code when necessary.

Many thanks,

Roger

********************************

Roger Hart
Assistant Professor, Departments of History and Asian Studies
University of Texas at Austin

office: Room 405, Garrison Hall
office phone: 512-475-7258
department fax: 512-475-7222
email: rhart at mail.utexas.edu
http://uts.cc.utexas.edu/~rhart

*********************************

--------------------- Info ---------------------
Mac-TeX Website: http://www.esm.psu.edu/mac-tex/
& FAQ: http://latex.yauh.de/faq/
TeX FAQ: http://www.tex.ac.uk/faq
List Post: <mailto:MacOSX-TeX at email.esm.psu.edu>