On Fri, 9 Aug 2002 11:10:36 +0200 wrote Thomas Templin <[EMAIL PROTECTED]>:

...
> > > > > On Wed, 7 Aug 2002 09:11:26 -0400 wrote Steve Litt
> > > >
> > > > I don't understand what you've written above, so let me
> > > > describe how I envision LyX character styles.
> > > > I envision it as a drop down box very similar to the
> > > > environment drop down box. Highlight the text, select the
> > > > character style, and the text is formatted (in LyX)
> > > > similarly to the intended .ps format, and exactly as desired
> > > > in the final .ps output. Character styles would be created
> > > > similar to environments -- in a .layout file or a style
> > > > file, and then incorporated using edit->reconfigure.

I thought about character styles that are local to the document, similar to
the macro
> > > \newcommand{\company} [1]   {\textbf{#1}}
in the LaTeX preamble. 

If the macros should be used for a whole bunch of documents, they could be
saved in a template file and would be available for all documents using this
template. 

-> I argue that this is easier to do for the average user than writing a
   *.layout file. 
-> It makes the documents more portable - you can mail them to another
   LyX-user without the need to give him/her the layout file too.

This is already working :-) but without GUI support :-(

My proposal is a GUI support for macros (i.e. the LaTeX \newcommand{}) that
I envision similar to the existing math-macro support: In the GUI you see a 
WYSIWYM representation, for latex it is a \newcommand.

    BTW: I'd prefer it without the 1.1.6 bug: math-macros are session-local in
    the GUI but document-local in the file.  
    Also, included lyx files should be scanned for macro definitions.


A drop down menu that lets you choose between all the macros in
the actual document is a good idea! (may be context-sensitive: all
math-macros when in mathed and all text-macros when in text mode)

And indeed it would be nice, if macros with placeholder ({#1}) would "wrap"
around the selection (if there is any) and open a box otherwise.


> > > Couldnt this be done by some kind of "special" latex include
> > > file? 

Actually with a lyx include file. (With the chance to relyx your
existing latex file.)

This works (in 1.1.6) with 2 drawbacks:
  - only for math mode (math-macros)
  - only if you open the included file in LyX before opening the
    including file (it might be closed afterwards, LyX remembers the
    macros for the session).


> > Using your standalone preamble idea, how do you envision the
> > process of actually tagging text as the character style in such
> > a way that it's fast and brainless for the author, ...

I'd like to see a twofold access:

  1. a function use-macro with the optional argument name that can be 
     bound to a kay (say '\' or something easier to access on a German
     keybord).  
     
     Often used macros could also be bound directly to a key, e.g. via 
       bind M-a s "use-macro "DNS" 
     
     If called without argument, it should insert a little box at the cursor
     position and wait for the name (ended by a space character)
     
     Now, the macro name gets replaces by the graphic representation of the
     "compiled" macro (with Desoxyribonucleinsaeure, say) with placeholders
     represented by a little box again or filled with a marked region. Exit
     the placeholder box in a way you do with the footnote box just now and
     again: replace the content with a graphical representation of WYM (the
     content in BOLD in our company example).
     
  2. a menu >Macros that lets you choose all your defined macros by name. If
     the macros from included files would go to submenues, it would be easy
     to define a per-document hierarchical structure for easy access to all
     the macros that will be defined during a 4 years Phd phase :-)
     
     It is up to the user do write a file Character_Styles.lyx and
     insert it in the Troubleshooters.lyx template.
     
Advantages: Often used macros are easy to access (either by knowing the name
            or by a custom keybinding).          
            Rarely used macros are recallable by the menu.


> A better way would be a script which is looking for words from a 
> list which should appear in a special character style and change 
> the lyx file itself. But I think this might be a way which is much 
> harder to implement into a LyX gui than using a standalone "style 
> file". 

Actually, I would not like too much automatism here. Nice option for a
post-processing of a lyx-file though. 

Recalls my feature request for an interface to arbitrary user-provided
scripts: On a keypress
  save the current buffer
  call a script with the file as argument (or your favourite text editor :-)
  restore buffer (and goto previous position)

Guenter

--
G.Milde at physik.tu-dresden.de

Reply via email to