On 01.11.2017 04:14, Richard Heck wrote:
On 10/31/2017 03:44 PM, racoon wrote:
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?

It's a reasonable request. Note, however, that it would essentially
involve replacing all the Document settings, at least if we really want
to use the defaults.

Seems fine to me. Am I missing what is problematic about it? I would even go so far that exporting and importing document settings would be nice.

Actually, come to think of it, here's another way to do it: Create a new
document; cut and paste the content of the old one.

Yes, that sounds like a reasonable alternative. At the moment the big problem with that is, as far as I know, there is no way in LyX to copy and paste the content with tracked changes. Though I think that could be fixed:

http://www.lyx.org/trac/ticket/10770

Daniel

Reply via email to