From 76c5902b4060e0a15b6c23dff273ad6721a9ac69 Mon Sep 17 00:00:00 2001 From: Georg Baum Date: Sun, 27 Nov 2011 11:57:47 +0000 Subject: [PATCH] Parse the picture variant of \framebox correctly (part of bug #6449) git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@40294 a592a061-630c-0410-9148-cb99ea01b6c8 --- .../test/box-color-size-space-align.tex | 1 + src/tex2lyx/text.cpp | 21 +++++++++++++++---- 2 files changed, 18 insertions(+), 4 deletions(-) diff --git a/src/tex2lyx/test/box-color-size-space-align.tex b/src/tex2lyx/test/box-color-size-space-align.tex index 4a6e4be0ea..278a5e1928 100644 --- a/src/tex2lyx/test/box-color-size-space-align.tex +++ b/src/tex2lyx/test/box-color-size-space-align.tex @@ -87,6 +87,7 @@ blabla \makebox[3cm][l]{makebox 3} blabla \begin{picture}(8,6) \put(0,0){\makebox(0,0)[tr]{AAA}} \put(8,0){\makebox(0,0){BBB}} +\put(0,8){\framebox(0,0){x}} \put(1,0){\line(1,0){6}} \end{picture} diff --git a/src/tex2lyx/text.cpp b/src/tex2lyx/text.cpp index 4e39654d29..71d36a56be 100644 --- a/src/tex2lyx/text.cpp +++ b/src/tex2lyx/text.cpp @@ -3606,17 +3606,30 @@ void parse_text(Parser & p, ostream & os, unsigned flags, bool outer, parse_outer_box(p, os, FLAG_ITEM, outer, context, t.cs(), ""); else if (t.cs() == "framebox") { - string special = p.getFullOpt(); - special += p.getOpt(); - parse_outer_box(p, os, FLAG_ITEM, outer, context, t.cs(), special); + if (p.next_token().character() == '(') { + //the syntax is: \framebox(x,y)[position]{content} + string arg = t.asInput(); + arg += p.getFullParentheseArg(); + arg += p.getFullOpt(); + eat_whitespace(p, os, context, false); + handle_ert(os, arg + '{', context); + eat_whitespace(p, os, context, false); + parse_text(p, os, FLAG_ITEM, outer, context); + handle_ert(os, "}", context); + } else { + string special = p.getFullOpt(); + special += p.getOpt(); + parse_outer_box(p, os, FLAG_ITEM, outer, + context, t.cs(), special); + } } //\makebox() is part of the picture environment and different from \makebox{} //\makebox{} will be parsed by parse_box else if (t.cs() == "makebox") { - string arg = t.asInput(); if (p.next_token().character() == '(') { //the syntax is: \makebox(x,y)[position]{content} + string arg = t.asInput(); arg += p.getFullParentheseArg(); arg += p.getFullOpt(); eat_whitespace(p, os, context, false); -- 2.39.5