> Index: lib/symbols
> ===================================================================
> RCS file: /cvs/lyx/lyx-devel/lib/symbols,v
> retrieving revision 1.44
> diff -u -r1.44 symbols
> --- lib/symbols       2003/10/13 09:50:08     1.44
> +++ lib/symbols       2003/11/03 09:31:29
> @@ -120,6 +120,8 @@
>  parbox            parbox      none
>  protect           protect     none
>  mbox              mbox        forcetext
> +# this is not perfect, a real inset would be better
> +intertext         mbox        forcetext
>  newcommand        newcommand  none
>  label             label       none
>  left              left        none

Not bad as work-around.

But maybe it's better to add proper \intertext support to mathed.
Should be not much more than copying and tweaking the mbox inset for
starters, even if the result is optically not perfect..

> ===================================================================
> RCS file: /cvs/lyx/lyx-devel/src/mathed/math_gridinset.C,v
> retrieving revision 1.131
> diff -u -r1.131 math_gridinset.C
> --- src/mathed/math_gridinset.C       2003/11/01 15:45:19     1.131
> +++ src/mathed/math_gridinset.C       2003/11/03 09:31:47
> @@ -217,6 +217,24 @@
>                       colinfo_[col].align_ = c;
>                       ++col;
>                       colinfo_[col].lines_ = 0;
> +                } else if (c == '@' && it + 1 != hh.end() && *(it + 1) == '{') {
> +                     lyxerr << "unknown column separator: '" << c;
> +                     int brace_open = 0, brace_close = 0;
> +                     for (++it; it != hh.end(); ++it) {
> +                             c = *it;
> +                             if(c == '{') {

Try to stick to LyX-style formatting:

       if (c == '{') {

[There are other plases like that]

> +/*!
> + * Output a space if necessary.
> + * This function gets called for every whitespace token.
> + *
> + * We suppress as many spaces as possible. This has two effects:
> + * - Reimporting LyX generated LaTeX files changes almost no whitespace
> + * - Superflous whitespace from non LyX generated LaTeX files is removed.
> + *
> + * The consequence is that the logic inside the function is
> + * complicated, but that's the price...
> + *
> + * We have three cases here:
> + * - A space must be suppressed. Example: The lyxcode case below
> + * - A space may be suppressed. Example: Spaces before "\par"
> + * - A space must not be suppressed. Example: A space between two words
> + */
> +void check_space(Parser const & p, ostream & os, Context & context)
> +{
> +     Token const next = p.next_token();
> +     Token const curr = p.curr_token();
> +     Token const prev = p.prev_token();
> +     string const name = next.cs();
> +     if (next.cat() == catSpace ||
> +         next.cat() == catComment ||
> +         (next.cat() == catNewline && next.cs().size() == 1) ||
> +         next.cs() == "par" ||
> +         next.cs() == "item" ||
> +         (next.cs() == "end" && (context.layout->latextype == 
> LATEX_ITEM_ENVIRONMENT ||
> +                                 context.layout->latextype == 
> LATEX_LIST_ENVIRONMENT ||
> +                                 active_environment() == "quotation" ||
> +                                 active_environment() == "quote" ||
> +                                 active_environment() == "verse" ||
> +                                 // LyX emits a newline before \end{lyxcode}.
> +                                 // This newline must be ignored,
> +                                 // otherwise LyX will add an additional protected 
> space.
> +                                 (active_environment() == "lyxcode" && curr.cat() 
> == catNewline))) ||
> +         // Or should we make a negative list? The alignment environments like 
> center would be included
> +         prev.cs() == "]" ||
> +         prev.cs() == "\\") {
> +             return;
> +     }
> +     context.check_layout(os);
> +     os << ' ';
> +}

Nice to see the comments.

Ugly as hell, but there seems to be not much of an alternative.

> @@ -293,8 +370,8 @@
>                               if (p.next_token().asInput() == "[") {
>                                       latex_inner_pos = p.getArg('[', ']');
>                                       switch(latex_inner_pos[0]) {
> -                                     case 't': inner_pos = "0"; break;
> -                                     case 'c': inner_pos = "1"; break;
> +                                     case 'c': inner_pos = "0"; break;
> +                                     case 't': inner_pos = "1"; break;
>                                       case 'b': inner_pos = "2"; break;
>                                       case 's': inner_pos = "3"; break;
>                                       default:
> @@ -318,11 +395,11 @@
>                               ss << '[' << latex_inner_pos << ']';
>                       ss << "{" << width << "}";
>                       handle_ert(os, ss.str(), parent_context);
> -                     parent_context.check_end_layout(os);
> -                     parent_context.need_layout = true;
> +                     parent_context.new_paragraph(os);
>                       parse_text_in_inset(p, os, FLAG_END, outer, parent_context);
>                       handle_ert(os, "\\end{minipage}", parent_context);
>               } else {
> +                     parent_context.check_layout(os);
>                       begin_inset(os, "Minipage\n");
>                       os << "position " << position << '\n';
>                       os << "inner_position " << inner_pos << '\n';

Does minipage really code its inner_position as 0 1 2 3 instead of 't',
'c', 'b'? *sigh*

--------

Ok. I don't have the time to check this thoroughly. It looks sensible,
so if you can confirm that the ound-trip on the UserGuide is no worse
than before, I'd commit this.

Andre'

Reply via email to