Am using "article" document class in LyX and trying to get the quote paragraph-environment to run with "small" text size and single-spacing (globally), while keeping the rest of the document (standard paragraph environment) with the default settings -- default text size and double-spacing.

Have tried using the following in the LaTeX Preamble:


This almost works. The problem is that some paragraphs in the standard environment take on the singlespacing that I am trying to apply (exclusively) to the quote environment. How do I make sure that the singlespacing only applies to the quote environment?


Add the following to the preamble:


A complete example:






enter image description here

\expandafter<token1><token2> will be replaced by <token1> expansion of <token2> and <token1> won't be expanded until after <token2> gets expanded.

  • Gonzalo, Thank you! This produces exactly the formatting that I was looking for. I am new to LyX and a novice when it comes to programming. If you have a moment, I would love to have a better understanding of the code that you've offered -- specifically, what is the function of "expandafter"?
    – J Forney
    Jun 9 '13 at 16:35
  • @JForney I've added a brief description of \expandafter. If you want a full understanding, you'll need some TeX reading; TeX by Topic is a good reference (texdoc texbytopic in a terminal). Jun 9 '13 at 16:50
  • @JForney You're welcome! Don't forget, that now that you've received answers to your questions, you can accept the one that you consider best solved your problem by clicking the checkmark to its left. In case of doubt, please see How do you accept an answer?. With a little more reputation you'll also be able to up-vote good answers :-) Jun 9 '13 at 17:09

I am a friend of the package etoolbox. It provides a lot of useful macros. One of them is \appto which adds material to a definition.


This method fails it the environment has any arguments. Therefor you can use the command \AtBeginEnvironment which is also provided by etoolbox:


The LaTeX-kernel defines also a hook. Unfortunately it's using the special symbol @. The command is \g@addto@macro. So you have to use \makeatletter/\makeatother:


\makeatletter explained

  • Gonzalo's code appears to have worked. I will try yours later, just for fun. I'm not sure what the relative benefits/detriments are for using your code versus Gonzalo's code. At any rate, I am grateful for your suggestion and the accompanying explanatory link.
    – J Forney
    Jun 9 '13 at 17:06
  • @JForney: For the result their will be no differences ;-). It's just another way. Jun 9 '13 at 17:08
  • @JForney: I updated my answer. There is a drawback of my first solution (equal to Gonzola's), it can handle environments with optional arguments. Jun 9 '13 at 17:27
  • Thank you for following up regarding the relative merits of the two solutions. I would give you +1, but I do not yet have the reputation points to do so.
    – J Forney
    Jun 10 '13 at 20:27

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.