Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

\pdftex_if_engine:TF giving wrong result after 20110628 l3kernel update #32

Closed
agrahn opened this issue Jul 1, 2011 · 11 comments
Closed
Labels
documentation Issues in the documenation

Comments

@agrahn
Copy link
Contributor

agrahn commented Jul 1, 2011

\pdftex_if_engine:TF always enters the true branch.

Test file:

\documentclass{article}
\usepackage{expl3}

\begin{document}

\ExplSyntaxOn
\pdftex_if_engine:TF{
\typeout{+++PDFMODE~+++}
}{
\typeout{+++DVIMODE~+++}
}
\ExplSyntaxOff

\end{document}

@josephwright
Copy link
Member

That is the expected behaviour. This is a test for the engine in use, not the output mode. Thus the test is true for pdfTeX and false for XeTeX and LuaTeX, but says nothing about the output. It is intended for dealing with cases where the different engines require different code (for example, in the fontspec package).

@agrahn
Copy link
Contributor Author

agrahn commented Jul 1, 2011

But yesterday the result was still different. Will I have to go back to package `ifpdf' ?

@agrahn
Copy link
Contributor Author

agrahn commented Jul 1, 2011

BTW, to test for the other engines mentioned, we could use the dedicated booleans defined in l3, couldn't we?

@josephwright
Copy link
Member

The definition has been tightened up, so the behaviour now is as-documented: the engine and the output are not the same thing. On the ways to test, you can also use the booleans, as you say.

@agrahn
Copy link
Contributor Author

agrahn commented Jul 1, 2011

Ok. I will (temporarily) revert to ifpdf. Do you intend to provide an output testing boolean to replace ifpdf anytime soon? This would be great.

@josephwright
Copy link
Member

We can certainly look at this. I need to think of an appropriate name (I guess \pdf_if_mode:TF, \pdf_if_output:TF and \output_if_pdf:TF are all possibles).

@blefloch
Copy link
Member

We already use mode for \mode_if_math:TF or \mode_if_inner:TF. Perhaps \output_if_pdf:TF would be the most logical. And \pdftex_if_engine:TF really ought to be \engine_if_pdf:TF, though I'd be happier with one prefix for both output type and engine (and other things such as "is shell-escape enabled").

@josephwright
Copy link
Member

I've argued (unsuccessfully) for \engine_if_pdftex:TF in the past. What you do need to remember is that a test for the engine is different from one for the output mode. For pdfTeX and LuaTeX, both DVI and PDF output are possible.

@wspr
Copy link
Contributor

wspr commented Aug 14, 2011

I hadn't considered what we should be calling \ifpdf in expl3, but if we do provide it, it should also allow a way to set the output mode. (Or we should choose not to offer that feature.) I think it's okay to have \mode_if_pdf, \mode_set_pdf, \mode_set_dvi, since there's no technical underlying rationale behind the word ‘mode’. If ‘mode’ distinguishes between math and horizontal and vertical, why not pdf/dvi as well? Okay, I admit it's a bit of a stretch.

By the way, just to explain the justification against \engine_if_pdftex, etc., was that for a while we were specifically trying to minimise the number of prefixes we defined in the kernel; having \engine_ with only three-odd functions seemed like a poor naming idea. Whether that was a good metric for us to use is rather philosophical, I think.

@blefloch
Copy link
Member

To avoid prefix proliferation, I'd prefer a common prefix for all those constants/almost constants which have to do with the general framework in which the document is typeset. Something like \state_if_engine_pdftex, \state_if_output_pdf, \state_set_output_pdf. But then I can't think of a good word for that. Would anything else fit in that same box?

Otherwise, we could have something like \g_output_type_tl equal to either pdf or dvi, and \c_engine_tl equal to one of the various possibilities.

@josephwright
Copy link
Member

I'm going to close here and open a new issue for the PDF output question.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
documentation Issues in the documenation
Projects
None yet
Development

No branches or pull requests

4 participants