3

My custom LuaLaTeX document class does not play nicely with some TeX GUI programs. That is because I have re-written some basic LaTeX commands. If a user tries to choose commands from a GUI menu, then the results will be unexpected.

Therefore, I instruct users to plain-code in a text editor, or use TeXWorks only. The reasons are documented. But of course, who actually reads instructions?

My question: Since my document necessarily uses LuaLaTeX, is it possible for a TeX document to identify whether it is loaded in a GUI? If so, is it possible to detect which one? "Other than TeXWorks" would suffice.

I expect that the answer to my question is "NO," but if there is some short and obvious code, I'd like to know. Not asking for deep thought. (LuaLa)TeX methods only.

12
  • Can you give some examples of things that don't work and why?
    – Alan Munn
    Commented May 22, 2017 at 18:53
  • 4
    Why should someone who types \large be less confused by this behaviour then someone who clicks a button? Don't deprive your users of the possibility to use whatever editor they know/like/have/... Commented May 22, 2017 at 19:31
  • 2
    Also instead of trying to manage users' behaviour via the editor, why not set your redefined commands to produce console class warnings or messages. Then people will see clearly that certain commands have been redefined and aren't available. Changing things silently isn't in your best interest.
    – Alan Munn
    Commented May 22, 2017 at 20:11
  • 1
    @AlanMunn That's a good idea, about settting the redefined commands to produce class warnings. Definitely solves the problem, and does not interfere with use of GUI. Please post as answer so I can accept it.
    – user103221
    Commented May 22, 2017 at 21:09
  • 7
    "I made the assumption that someone hand-typing the code has read instructions". Clearly you haven't met @DavidCarlisle. :)
    – Alan Munn
    Commented May 22, 2017 at 21:15

1 Answer 1

8

The simple answer to your question is that there is no way for TeX to know how the file its processing was edited, nor should there be.

And there's no functional difference between someone typing one of your redefined commands directly into their source document and clicking on some IDE's menu item: the effect on the output will be mysterious either way, assuming they haven't read your documentation.

So instead of trying to manage users' behaviour via the editor, you should set your redefined commands to produce console class warnings or messages. Then people will see clearly that certain commands have been redefined and aren't available. Changing things silently by using \let\command\relax isn't in your best interest.

You must log in to answer this question.