In Lyx, is it possible to change package options of packages that are loaded by modules? Specifically, I tried to set the options of the todonotes package which I use in conjunction with the TODO Notes module. This module loads the package without passing any options to it. Specifically, it adds


to the preamble.

Adding another \usepackage[myOptions]{todonotes} to my preamble causes an options clash. I tried to

  • Set the options globally by passing them to the document class (as suggested by LaTex and this answer). No error, but also no effect.
  • Use \PassOptionsToPackage. No error, but also no effect. I think this command must be used before loading the package, which I can't do as the module's preamble additions are done before the user's additions.

A possible solution would be to change the module itself. But I don't like this solution much because it would have a system wide effect where I only want it to affect the document. (Also, I don't want to change the moule on all machines I use)

What other options do I have?

  • Maybe \AtBeginDocument{\PassOptionsToPackage{…}}. Another solution to prevent such clashes generally consists in writing the options as options for the document class. Not knowing what are these options, the class will propose them to every loaded package. – Bernard Dec 1 '15 at 11:33
  • @Bernard Thx for your reply. AtBeginDocument does not work in my case but passing the options to the doc class does. I had tried this but had the tikzexternalize package in effect which prevented a rerendering of the Todo notes. – Deve Dec 1 '15 at 13:17
  • Just a note that this question was cross-posted here: mail-archive.com/lyx-users@lists.lyx.org/msg102186.html – scottkosty Dec 1 '15 at 22:48
  • reposted (because mailing list was not working) at mail-archive.com/lyx-users@lists.lyx.org/msg102187.html and at mail-archive.com/… – scottkosty Dec 1 '15 at 23:07

Buried in the discussion on the LyX forum at https://www.mail-archive.com/lyx-users@lists.lyx.org/msg102234.html there seems to be an answer if you're using LyX 2.2 or higher. Place into Document > Settings > Local Layout:

PackageOptions todonotes myoptions

This has worked for me in LyX 2.2.0 to set the notes background color to a pastel green:

PackageOptions todonotes backgroundcolor=green!40
  • Thats right. Actually it was me who started this discussion :) – Deve Jul 10 '16 at 9:20

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.