Tommaso Cucinotta wrote:
Now the question is: what use do other environments do of this optional
argument ?
Is that always an alternate text to be used when producing dvi/ps/pdf ?
No. Hypothetically, any environment whose LaTeX command allows optional
arguments (in the form \mycommand[myoptions]{blah}) could get an
optional inset. If you look at the Beamer layout, for instance, you'll
see that Itemize, Enumerate and Description lists all can take optional
arguments, which are obviously not titles. The BeginFrame environment
takes an optional argument which is used to control how the frame
contents gets chopped up into overlays. For this reason, I suggest we
use a generic label such as "optional argument" or "optional parameter"
rather than anything relating specifically to titles.
If it is not, then a context-sensitive menu would be a great thing, with
a text that appears differently depending on what is written on the layout file as
the name of that option. Anyway, it's a matter of introducing context-sensitive
menus in LyX, what is currently completely missing and would instead greatly improve
usability.
Agreed. Good luck developing that. :-)
... I'm having a suspect ... are most of the LyX main developers Mac
users ?!? :-)
Actually, I think they are mostly Linux users.
That said, I'd like to highlight that I can't see a utility for the user
having the flexibility to place the optional argument (inset) wherever he/she
wants, in the text, or in having the ability to cut and paste the entire inset (the
containted text would be useful, but I was wondering about the meaning of copying an
optional arg). I checked you cannot insert it twice in the same paragraph, but,
for example, you *can* insert one inset for each paragraph, within the same
multi-paragraph layout. A quick look at the source through "View Source"
shows that the second inset seems to be ignored. Ok, guess this may be seen as
a bug.
Each environment has an associated LaTeX command that accepts some
number (usually zero) of optional arguments. In the layout file, you
tell LyX how many optional arguments to allow. Regardless of where
within the environment the user chooses to enter an optional argument,
it's going to end up in the command invocation (for instance,
\section[short title]{...}, regardless of where inside the section line
the short title is declared). If the user enters more optional
arguments than the command allows, I think it's fine for LyX to ignore
either the first ones or the last ones.
That said, I don't think LyX can really enforce the limit on the number
of arguments (other than when the limit is none). If I have an
environment with OptionalArgs set to 1, and I open the optional argument
inset and type a bunch of arguments separated by commas, I don't think
LyX checks that (does it?). I'm pretty sure I've done this
(legitimately) with Beamer. Of course, if I enter more arguments than
the LaTeX command allows (or incorrect arguments), I risk having LaTeX
get snippy with me when I compile the document.
Last, consider to never change something that (basically) works :-)
Generally a wise idea. In this particular case, though, if the user
does not know the option is there, I'm not sure we can consider it working.
/Paul