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.
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
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.