Uwe Stöhr | 8 Jul 2012 21:09
Picon

[patch] support the commands \fbox and \mbox

For an unknown reason LyX supports \framebox and \makebox only _with_ command options. \framebox{} 
and \makebox{} (which is the same as \fbox{} and \mbox{}) are not supported.

Support for them would be very useful because one often has the case that one wants to simply draw a 
box around a single word or phrase and for that purpose you cannot use \framebox with options.

The attached patch adds support for \fbox and \mbox.
I have there used a hack where I code the case of no option to the length "-999col%". This works but 
I am not happy with this. There must be a way to omit specifying a length but I can't figure out 
how. Any help is highly appreciated.

(The patch would be a fileformat change.)

thanks and regards
Uwe
Attachment (fbox-support.diff): text/x-diff, 15 KiB
Jean-Marc Lasgouttes | 9 Jul 2012 12:29
Favicon

Re: [patch] support the commands \fbox and \mbox

Le 08/07/2012 21:09, Uwe Stöhr a écrit :
> The attached patch adds support for \fbox and \mbox.
> I have there used a hack where I code the case of no option to the
> length "-999col%". This works but I am not happy with this. There must
> be a way to omit specifying a length but I can't figure out how. Any
> help is highly appreciated.

If you assign a length with value "Length()" it will have unit UNIT_NONE 
and value 0. You can then test for this case with

   if(width_string.empty())
    ...

Other than that, I cannot comment on the patch, as all I remember from 
the existing code is that it is horribly ad-hoc to make various types of 
boxes "look well". Please make sure you are not making it worse.

JMarc

Pavel Sanda | 10 Jul 2012 01:59
Favicon

Re: [patch] support the commands \fbox and \mbox

Uwe Stöhr wrote:
> I have there used a hack where I code the case of no option to the length 
> "-999col%". This works but I am not happy with this. There must be a way to 

It is indeed very ugly. In case you can't find better solution at least define
some constant sensible_name=-999col% and use this constant, do not spray such
silly strings all over the place.

> +	widthCB->setEnabled(itype == "makebox" 
> +		                || (outer == "Boxed" && itype == "none"));

I see this type of hardcoded structure used multiple times. Is it some semantic
structure which could be generally rewritten by bool some_box_feature(itype,outer)?

In case this is file format change, some things are still missing for review.
Pavel

BTW you seem to miss multiple messages on list. Do you read it or react only
when directly CC-ed?


Gmane