There have been a few questions here on how to pass options to packages in LyX, especially those loaded automagically.

Fuhrmanator in https://tex.stackexchange.com/a/318743/42648 and https://tex.stackexchange.com/a/318745/42648 tells about using the Document > Settings > Local Layout settings and adding PackageOptions there.

PackageOptions geometry includeheadfoot
PackageOptions url hyphens

which if I understand correctly, expands to commands like \PassOptionsToPackage{hyphens}{url}

However, as Deve mentions in Can I change options of packages loaded by a Lyx module?

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.

I also had problems passing in some of the core documentclass options (I am using KOMA-Script report class) using this method.

Further, Bernard points out in answer to footer options in Lyx that one can use \geometry{} in the document preamble to pass options to the geometry package in LyX.

My question:

Is the command \geometry specific to the geometry package, or if one can use a similar mechanism to pass options to any package. For example, \url{hyphens} instead of PackageOptions url hyphens.

What would/should be the preferred method?

  • Though I don't know a complete answer to your question, \geometry is specific to the geometry package: the hyperref package uses \hypersetup, and some packages don't have a command to do this. In the case of url, the \url command is used to typeset URLs, e.g. \url{www.google.com}, so cannot be used for this purpose. Aug 12, 2016 at 17:50
  • Thanks @ArunDebray. This clarification is very helpful! Will need to dig into these commands. I missed the \url part :( Any pointers to where one can get a lift of such setup commands? Aug 12, 2016 at 18:00
  • Since it's different in every package, you'll have to look at each package's documentation, I think. Fortunately, it looks like the answer provided gives you a way around this. Aug 13, 2016 at 15:32

1 Answer 1


Another option that you did not mention is in Document > Settings > Local Layout do

Provides url 1

This tells LyX not to automagically load the url package. Note that there should be 1 (true) or 0 (false) behind this option if you want to use it in a layout file. Then in the preamble you can load the url package yourself with the options you wish.

  • Well, I did not know about this! So, by adding this option, I can prevent the loading of any packages, right? And load them myself with all necessary options? On a related note: any way to find out what packages are loaded (other than export to TeX and grep \usepackage)? Also, if i want to load polyglossia instead of babel, do I say Provides babel or Provides polyglossia or both? Aug 12, 2016 at 18:47
  • To find out which packages are used, you could in LyX go to View > Source and then in the options on the right choose "Preamble only". Regarding polyglossia instead of babel, might as well put both. Also you might need to make sure that in Document > Settings > Language for "Language package" you don't have anything in the text box.
    – scottkosty
    Aug 12, 2016 at 21:05

You must log in to answer this question.

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