TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I have a LyX document filled with text and equations like in a scientific paper. To focus only on the math sometimes it can be really useful to only print/output the formulas and not the text around it. Is there any way to do this automatically in LyX? So far I manually copy all the equations but that is not convenient in the long run. All equations are numbered and centered in the math mode.

share|improve this question

try with the following in the preamble:


then it generates a new file with the chosen contents.

share|improve this answer

It is with extreme reluctance that I suggest a perl script that I once wrote called mathgrep for this purpose. It was designed to mess with mathematics inside a LaTeX document, leaving non-mathematics environments alone. It is not particularly sophisticated in that if you mess with how you start and stop maths sections then you can easily confuse it, but on a regular document it ought to work (so long as you've used proper LaTeX \( ... \) and not TeX $ ... $).

You can get it from mathgrep. It needs Perl (plus a couple of perl libraries). If you've not used any weird maths environments, then:

mathgrep '/.*/' latex_file.tex

should produce all of the mathematics (inline maths includes surrounding text, by the way). You'd need to include the preamble yourself.

share|improve this answer

You can put the equations or the text in a branch. Then you can activate or inactivate the branch. Inactivated branch will not be printed when you convert the document into PDF.

Go to Documents -> Settings, select branches, enter a name for the branch, click on add and then high lighten the branch and select either activate or deactivate. In the document itself begin typing your equation and when you need to insert a text do the following: Go to Insert -> Branch and click on the name of the branch you need to insert. type your text inside this branch. Hope that this will be clear

share|improve this answer
As @tohecz mentioned, please provide a usable and understandable solution to the problem. – Camil Staps Jan 9 '13 at 8:11

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

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