Thanks el,

The article looks very promising.  I see that the mailmerge package is in the 
texlive extras 
debian repositories, I have downloaded texlive extras and will give it a try.  
First have to 
remember how to make mailmerge live.  I have done that kind of thing before so 
it should 
not be all that difficult.

John

On Saturday, April 1, 2017 5:05:44 PM PDT Dr Eberhard Lisse wrote:
> In the first instance I did a Google search,
> 
> https://www.google.com/search?q=mail+merge+lyx
> 
> which returns as the first hit:
> 
> http://ftp.lyx.org/pub/tex-archive/macros/latex/contrib/mailmerge/
> 
> maybe look there...
> 
> greetings, el
> 
> On 2017-04-01 00:13 , Richard Heck wrote:
> > On 03/31/2017 04:05 PM, John White wrote:
> >> I use lyx and am using it more and more in what I call "mailmerge"
> >> mode, similar to how I once used mailmerge in Wordstar. Once I have a
> >> good form document (say a will or a contract) I replace the names
> >> with, say "@name1" and then I replace all @name1 with the new data,
> >> e.g. "Judy Jones".
> >> 
> >> 
> >> 
> >> This works fine, but on longer documents (say a 40 page document)
> >> with, say @name1 through @name12, it can get a bit confusing. I put
> >> all the replacement data in a separate lyx file and go back and forth
> >> to that file until I have made all replacements.
> >> 
> >> 
> >> 
> >> I use article class.
> >> 
> >> 
> >> 
> >> Is there perhaps a better layout or class or perhaps something else
> >> lyx that I should be using?
> > 
> > The easiest way to do this would be to use some LaTeX in your LyX
> > 
> > document. Where you now have "@name1" put, say:
> >     \nameone
> > 
> > in ERT. Now in the preamble, say, put:
> >     \def\nameone{Judy Jones}
> > 
> > This is a LaTeX variable, or "macro".
> > 
> > You could also do something like:
> >     \def\nameonef{Judy}
> >     \def\nameonel{Jones}
> >     \def\nameone{\nameonef \nameonel}
> > 
> > and now you have access to first, last, and full names.
> > 
> > You can also put all of that in some separate LyX file, if you like, but
> > as ERT, and include it at the beginning of the file.
> > 
> > Caveats:
> > 
> > LaTeX does not allow numbers in variable names, only letters (well,
> > close enough). Hence "one".
> > 
> > You'll have to be careful to avoid naming conflicts with what LaTeX
> > already predefines. One way to do this is to use names like, e.g.,
> > \MERGEnameone.
> > 
> > You may run into problems with spaces after such macros. This is because
> > LaTeX sees the space after the macro as just separating it from what
> > follows, not as an actual space. You can handle this in a couple ways.
> > 
> > First, in the LyX file, you can do:
> >     \nameone{}
> > 
> > in ERT. Now the braces terminate the macro, and LaTeX will treat a
> > following space as an actual space. The other option is to use the
> > 
> > xspace package. So the macro gets defined as:
> >     \def\nameone{Judy Jones\xspace}
> > 
> > and you put
> > 
> >     \usepackage{xspace}
> > 
> > into the preamble. The \xspace macro adds a space, but only if what
> > follows isn't punctuation, etc. It isn't perfect, but it usually works.
> > 
> > This is a very simple approach. Try searching "latex mail merge" for
> > more sophisticated ones.
> > 
> > Richard

Reply via email to