Edit Links |
Tips /
DebuggingLayoutFilesCategories: Troubleshooting, Layouts << | Page list | >>This pages gives some tips for creating and debugging Lyx Layout files. Simple script to regenerate Postscript outputThis debugging script was taken from Steve Litt's page. echo q to quit, e to edit in LyX, anything else to regenerate Postscript read var until test "$var" = "q"; do cd rm -f hello.ps echo; echo; echo; echo; if test "$var" = "e"; then lyx hello.lyx else lyx --export ps hello.lyx gv hello.ps fi echo q to quit, e to edit in LyX, anything else to regenerate Postscript read var done Script to help layout debuggingNOTE <<RH>> This script will become obsolete in the 1.6 series, since there is a new LyX function layout-reload that reloads the layout of the current document. By default, it is not bound to any key, but it can be entered directly in the mini-buffer. So, after making changes to a layout file, one types "layout-reload" in the mini-buffer, and the new layout is reloaded. From Steve's post on the users' list. Layout file changes require reconfiguring of LyX (Tools->Reconfigure, then close the info box, then exit LyX, then start LyX, then View->Postscript). All that mousing around makes layout file debugging slow as molasses. <<RH>> This isn't true in the 1.5 series. You only need to reconfigure when you add a NEW layout file. If you've just made changes to the old layout file, then you just need to shutdown LyX and reload it to see the changes. The following bash script, which is called lyx_reconfigure.sh and should be placed on your executable path, performs a reconfiguration of LyX directly from the command prompt: #!/bin/bash LYXDIR=/usr/share/lyx # CHANGE THIS TO SUIT YOUR SYSTEM cd ~/.lyx $LYXDIR/configure.py cd - Once you have the preceding script on your path, here's an example on how you use it to test a layout change with a single command: #!/bin/bash MYDVIVIEWER=xdvi # CHANGE THIS AS APPROPRIATE MYPDFVIEWER=acroread # CHANGE THIS AS APPROPRIATE MYLYXFILEPREFIX=vimtonight # CHANGE THIS AS APPROPRIATE MYLYXFILE=$MYLYXFILEPREFIX.lyx MYTEXFILE=$MYLYXFILEPREFIX.tex MYDVIFILE=$MYLYXFILEPREFIX.dvi MYPSFILE=$MYLYXFILEPREFIX.ps MYPDFFILE=$MYLYXFILEPREFIX.pdf ### REMOVE OLD INTERMEDIATE AND OUTPUT FILES ### ### TO PREVENT BEING FOOLED BY COMPILE FAILURES ### rm -f $MYTEXFILE rm -f $MYDVIFILE rm -f $MYPSFILE rm -f $MYPDFFILE ### REBUILD AND VIEW OUTPUT FILE ### lyx_reconfigure.sh lyx -e latex $MYLYXFILE latex $MYTEXFILE $MYDVIVIEWER $MYDVIFILE ### CREATE PDF FILE (CAN BE DONE DIRECTLY ALSO) ### ### FOR DEBUGGING AND EXPERIMENTATION, ### ### THE FOLLOWING IS UNNECESSARY AND ### ### CAN BE COMMENTED OUT ### #dvips -o $MYPSFILE $MYDVIFILE #ps2pdf $MYPSFILE #$MYPDFVIEWER $MYPDFFILE Using the preceding script, one can change a layout file, run the script, and view the result. No need to mouse around with GUI LyX. This will significantly increase productivity in layout troubleshooting and experimentation. Note that the example shellscript above is simple. If your content needs to rebuild indices, it might be more complex, but even so, you can now experiment with a layout without the need to manually reconfigure each time. Contributor: Steve Litt Category: Troubleshooting, Layouts |