On 25.10.2017 22:07, Richard Heck wrote:
On 10/24/2017 09:37 AM, racoon wrote:
Hi

I know of the "Save as Document Defaults" in the document settings.
What it seems to do is create a default document with preferences that
is loaded when one creates a new document.

However, if I have created a number of documents using those defaults
and discover that I would like to have something differently, is it
possible not only to save the new settings to the defaults for new
documents but also apply those defaults withing other already existing
documents?

I guess I am missing an "Apply Document Defaults" button in settings.
But maybe there is a different way in LyX to do this.

There's no way in LyX to do this, but the fact that LyX files are just
text files makes it easy to do outside LyX. One option is to write a
really basic filter and then run it on your files. For example, if you
wanted to use refstyle, whereas you hadn't previously, you could just do:
     perl -ibak -pe 's/\\use_refstyle 0/\\use_refstyle 1/' *.lyx
Of course, if it's just that one thing to change, that's maybe not so
helpful. But if there were several changes....

Many people use similar techniques to make all kinds of changes to LyX
files. Just as an example, I'm attaching a Perl script I used a little
while ago to change all citations to a particular book to citealias-type
citations. I prefer to write these things in Perl, since it was more or
less designed for this sort of thing. But you could also do it in
Python, of course, or sed or awk, if you're really masochistic.

Thanks Richard. I will have to look into it when my changes to the default get too many to keep track of them and do them manually for all the older documents. But wouldn't this be a nice feature to have in LyX right next to the Save Defaults button? Maybe your script could be used for that?

Daniel


Richard

PS The cite*alias commands are supported by an updated citeengine I
wrote, which I've also attached, again as an example. If you search for
"alias" you'll find what I added.

(which I'd written a new citeengine file to support, also attached, also
as an example).



Reply via email to