My meta-discussion topic is about the question that follows:

The listings manual (v1.5b, subsection 4.18) recommends using \lst@definelanguage instead of \lstdefinelanguage in a style file:

Where should I put my language definition? If you need the language for one particular document, put it into the preamble of that document. Otherwise create the local file lstlang0.sty or add the definition to that file, but use \lst@definelanguage instead of \lstdefinelanguage. [...] However, I can't find a reason for this distinction between \lst@definelanguage and \lstdefinelanguage in either the manual or the developer guide. Is the distinction important?

You may be wondering why I'm asking this question... Well, I've managed to get everything working in my style file using \lstdefinelanguage. That said, I'd like to follow the guidelines laid out in the listings documentation as closely as possible.

However, if I simply substitute \lst@definelanguage for \lstdefinelanguage, I run into problems. Here is an MWE:



% --- generate the style file --- \begin{filecontents*}{mystyle.sty}
\NeedsTeXFormat{LaTeX2e} \ProvidesPackage{mystyle}

\DeclareOption*{\OptionNotUsed}   \ProcessOptions\relax



\endinput \end{filecontents*} % --- end of style file ---


\begin{document} \begin{lstlisting}[language=Mylanguage] foo bar baz


Everything is hunky-dory with the code above, but if I simply replace \lstdefinelanguage by \lst@definelanguage, the listings packages throws two errors:

Couldn't load requested language.


language mylanguage undefined.

This seems to contradict the manual's claim that \lstdefinelanguage and \lst@definelanguage have the same syntax; at least, based on my simple test, they don't seem equivalent when in comes to expansion of their first argument.

Should I use \lst@definelanguage instead of \lstdefinelanguage and how can I get the former to work in my MWE?

My answer was to change the value to iftrue in the corresponding line of \lst@definelanguage in the file lstmisc.sty of the listings package, and the document, therefore, would compile accordingly.

The only useful remark that one of the main commentators managed to say in the end, was in the lines of: I use \lstdefinelanguage because I don't know the internal commands. endquote. This however, left upon me a disconcerting impression that the commentator was just trying the mend this miserable tore up question. What else?

The other remarks were clearly copied verbatim from the listings manual. That is, the comments about the local file and the use of \lstdefinelanguage, with the corresponding language files that follow. Not surprisingly, the OP was desperately willing to accept this answer.

But this is clearly a vague excuse. A vague excuse that the OP was desperately willing to accept, So desperate in fact, that I am sure he regretted posting the question, he regretted further elaboration of its premises, and generally speaking, asking this kind of question to start with. Then my answer came in, which set off the alarms. Then back to the OP who should have done the homework but he didn't. The commentator, on the other hand, should have provided a better opinion, but he failed. And the bottom line is that this question that I loved so much, me, me, not the OP nor the commentator, is now, sadly, nowwhere to be found. Google cache no longer applies, and the realization that the best answer to fix it, was largely ignored and downvoted, is a fact now.

So, back to the question: Should I use \lst@definelanguage instead of \lstdefinelanguage and how can I get the former to work in my MWE?

  • No, you can't use \lst@definelanguage, because the manual is incorrect, but you can change it to \iftrue
  • Yes, you can use \lst@definelanguage because the manual is correct, and you can change it to \iftrue
  • It's up to you, you can't use \lst@definelanguage because the manual is incorrect, but you can change it to \iftrue
  • It's not up to you, you can use \lst@definelanguage because the manual is correct, but you can change it to \iftrue
  • It's not up to you, you can't use \lst@definelanguage because the manual is incorrect, but you can change it to \iftrue.

What are my options? If I only knew how to count. But most important, give me one reason why this question should be deleted.

  • 2
    In its current form this really doesn't work very well as a question either here or on the main site. Can you perhaps par it down to a core concern?
    – Joseph Wright Mod
    Mar 6 '14 at 14:47
  • 1
    @Jubobs had a related question but unfortunately has deleted it...
    – cgnieder
    Mar 6 '14 at 18:25
  • please fix the title statement. at the moment, it looks like "why should x be preferred over x" -- no difference between the two objects. i could change it, but think it better if you fix it. Mar 6 '14 at 21:46
  • @barbarabeeton fixed.
    – doed
    Mar 7 '14 at 7:25
  • @cgnieder I deleted that question because the premise was incorrect, which you helped me understand (thanks) and also because it generated a discussion that was getting out of hands. I can undelete the question if there is enough pressure, but I don't really want to, at the moment.
    – jub0bs
    Mar 7 '14 at 21:55
  • @JosephWright good point. In all honesty, and with the utmost respect to you, I have to tell you the first thing that crossed my mind when I read your comment. If expl3 is part of it, I find it uh, bland, maybe another word, but that was the first one> Also ever since I installed Minion Package I have been having problems in the system. Sorry, maybe my comprehension level can't figure it out
    – doed
    Mar 8 '14 at 13:37
  • @JosephWright The way luatex has been implemented, sorry, sorry, but same thing. In the same category.
    – doed
    Mar 8 '14 at 14:13
  • @JosephWright what I'm trying to say, is I find no excitement reading it
    – doed
    Mar 8 '14 at 14:16
  • @Jubobs Yes, I remember. Even if the premise might have been wrong I think it was a good question.
    – cgnieder
    Mar 8 '14 at 16:29
  • @cgnieder I've undeleted the question.
    – jub0bs
    Mar 9 '14 at 13:36
  • If based on principle, my answer to change \lst@definelanguage to \iftrue is false in the file lstmisc.sty of the listings package, that is, in the line \lst@UserCommand\lst@definelanguage{\lst@DefLang\iftrue} with or without other packages involved, so the document or MWE would compile, then,
    – doed
    Mar 9 '14 at 21:46
  • then, based on principle, yes, based on principle, and I'm aware of it, then, it is true that my other answer, my other answer to change ) in line {\lst@ifbreaklines \lst@Def{)}{\lst@breakProcessOther)}\fi}` of the file lstmisc.sty in the package listings holds false as well. Therefore, my answers related to the package listings are invalid, and should be removed, erased, deleted,
    – doed
    Mar 9 '14 at 21:47
  • for it holds true that any modification or alteration in the package listings is disallowed to start with. How would a convention hold its truth value if its principle is not satisfied.
    – doed
    Mar 9 '14 at 21:47
  • Despite the falsity of some statements here or elsewhere, At the end of the day, it is a shame, and let me repeat it, a shame to look and find so many talented individuals, yes, talented. pushing or trying to push an idea. The bottom line, unfortunately, and although is a fact, yes, a fact that an idea starts everything, a convention should not hold its grounds against it, since an idea comes before it. And those who would even dare in trying to correct me or refute me, will fail miserably.
    – doed
    Mar 9 '14 at 21:48

I just realized that this question is (partly) about me as I was »the main commentator« so I want to present the story from my point of view:

I made honest comments on both question and answer about what I thought and still think:

I for my part am reluctant to change commands from packages and only do so if I know exactly what the changes are doing. Your answer suggested a change in \lst@definelanguage and I asked if you could explain exactly what the change does (except something along the lines of: »the code then works« which I didn't and still don't find a very satisfying answer...). It seemed to me (but maybe I was mistaken) that you knew where, when and why the \iffalse/\iftrue business makes a change so I asked for clarification.

Clarification never came and in consequence I went to study the listings code myself but I must confess that I failed to find out where exactly said \iffalse/\iftrue business makes a difference. (I found some hints but not enough for an answer...) I also studied the listings manual again and commented on the question how I interpreted it:

\lst@definelanguage is only meant to be used in a file called lstlang0.sty. listings already loads lstlang1.sty, lstlang2.sty and lstlang3.sty and would load lstlang0.sty if it finds it. lstlang0.sty is meant as a local addition for a user to have definitions of languages he often uses and in such a file \lst@definelanguage works just fine as it is. (I had tested this...) For every other application \lstdefinelanguage is the way to go. (IMHO the manual could be improved to be more explicit about this.)

I honestly think this is how the listings author intended the commands to be used and the OP seemed to agree with me and shortly after deleted the question. The correct answer here can of course only be given by the author of listings. Everything else is just interpretation of both code and manual. Generally it's up to an OP to decide which answer they deem correct - this is why there is the green tick for answers.

As to why the OP deleted his/her question: everybody is allowed at any point to delete their own question without having to justify it. I liked the question and so did others who voted for it but it's not up to me or anyone else to decide if the question should stay or not. So there's not much you or me or anyone else (except the OP) can do about the question being deleted.

If you really liked the question and think it's worth being there on the main site why don't you just ask a similar question yourself? That would be a perfectly valid thing to do IMHO :)

  • petitio principii written all over. Over and over again. And again! You said: I honestly think this is how the listings author intended the command. Not only that but the manual states one thing, and the code states something entirely different. How are you going to compile a document with \lst@definelanguage set to iffalse. By your answer we are back to point A. Over and over again! And this does not seem to stop.
    – doed
    Mar 9 '14 at 7:49
  • So you honestly think that the author intended the command, uh? what? Did he whispered in your ear, those last words, but you still think he did so. Oh gosh, great discussion.
    – doed
    Mar 9 '14 at 8:19
  • 2
    Well, of course: I repeated what I had commented so others can know what it's all about. Besides: I haven't changed my opinion. But I also don't understand why that is a problem. If you disagree with me that's just fine. That's what a community is for: gathering several opinions and as OP decide which one you deem the best answer for the question.
    – cgnieder
    Mar 9 '14 at 9:20
  • 1
    Yes, I think it's what the author intended: it's what he says in the manual...
    – cgnieder
    Mar 9 '14 at 9:21
  • On the 'deleting questions' point: the OP can delete if there are no answers, but once some have been posted the situation changes as there is then 'content' belonging to others to consider.
    – Joseph Wright Mod
    Mar 9 '14 at 11:31
  • @Joseph Maybe so but the site does allow deleting questions even if they have answers. I agree that for someone who answered a question it is very frustrating if the question is deleted but I don't see what he can do about it...
    – cgnieder
    Mar 9 '14 at 12:25
  • @cgnieder Yes, but when there are answers it's not just a single vote that decides things (mods excepted)
    – Joseph Wright Mod
    Mar 9 '14 at 12:56
  • @Joseph Ah OK. So more people than just the OP must have agreed that the question should be deleted?
    – cgnieder
    Mar 9 '14 at 13:06
  • @doed Instead of being rude/offensive/ironic (it may be the wrong English word here) to cgnieder you could write to the maintainer. The package was de facto unmaintained for years, but now the new maintainer even provided a new version. Point him to this question and also the your supposed bug patch.
    – Speravir
    Mar 9 '14 at 19:04

Well, to be honest, this is a pretty minor issue that can be fixed either, by biting the bullet and reading the code carefully, or mailing the author of the package. Other than that whether it is this or that is not much of a discussion material in my opinion.

There is no need to delete the question by the mods but also no need to undelete by the mods if the owner deleted it.

Couple of things to keep in mind; modifying the original files of the packages is really, really, really bad idea. You change the checksum hence on some systems it causes problems, you can't anticipate behavior of packages that rely on that package, you get name clashes of some other esoteric code in terms of backwards compatibility etc. etc.

So if possible fix it by patching the particular macro not changing any files.

  • I can not agree more with you. In principle, of course, in principle.
    – doed
    Mar 9 '14 at 6:24
  • at this point, and after reading the first answer above yours. I tell you: I don't care. As a matter of fact, I tried to delete, yes, remove, erase, my main answer to the listings package. I have two answers, and I wanted to delete the main accepted answer, but the site does not allow me to do so, because it's accepted. Of course, I will delete the other one that @GonzaloMedina asked, but only after the main one. And I'm aware that others voted for it. But they will understand my reasons.
    – doed
    Mar 9 '14 at 8:01
  • @doed I can't follow what you meant. But it sounds like a simple issue that can be solved by commenting the question etc. note that packages/manuals can always have errors/typos so it doesn't invalidate the effort they put in
    – percusse
    Mar 9 '14 at 8:12
  • Typos? Errors? I guess so. Too many in fact, right? Like the famous ) I supposedly fixed. Ha! Without going back to the post in question, I remember reading @egreg 's comment that he believed it was a bug. But it never looked like one to me. Not then, not in a trillion years from now. Nope!
    – doed
    Mar 9 '14 at 8:46
  • @doed Regarding that answer you want to delete, I'm assuming you're referring to that one. Right? I can unaccept it, if you really want to delete it...
    – jub0bs
    Mar 9 '14 at 13:39
  • @Jubobs of course, but nobody has to accept your conventions either. Are you the author of the package? If yes, then you are right, if no, then, you are wrong.
    – doed
    Mar 9 '14 at 21:21
  • @doed I really don't understand where you get those ideas (I never claimed to be the author of listings) and why you lash out at anybody who tries to have a normal discussion with you...
    – jub0bs
    Mar 9 '14 at 21:25
  • @Jubobs alright. It's funny that you say I'm apprehensive, but for some reason, look at this question which it has some votes, and as soon as you come and post even a comment, that's it, the question is off, it gets closed.
    – doed
    Mar 9 '14 at 21:34
  • @Jubobs you have a pattern of deleting questions, editing, so why should this question, my question, be any different when you post something?
    – doed
    Mar 9 '14 at 21:36
  • 2
    @doed Mail the author. This discussion is not getting anywhere. We don't need to come to an agreement. Let's delete everything and you start a new question. If the author replies we are all good, otherwise we wait for someone to read the code. By the way did you check the code?
    – percusse
    Mar 9 '14 at 22:22

Not the answer you're looking for? Browse other questions tagged .