Menu "edit_math"
Item "Make eqnarray|e" "break-line e"
Item "Make multline|m" "break-line m"
- Item "Make alignat 1 column|1" "break-line 1"
- Item "Make alignat 2 columns|2" "break-line 2"
- Item "Make alignat 3 columns|3" "break-line 3"
+ Item "Make align 1 column|1" "break-line 1"
+ Item "Make align 2 columns|2" "break-line 2"
+ Item "Make align 3 columns|3" "break-line 3"
+ Item "Make alignat 2 columns|2" "break-line B"
+ Item "Make alignat 3 columns|3" "break-line C"
Separator
Item "Toggle numbering|n" "math-number"
Item "Toggle numbering of line|u" "math-nonumber"
+2001-02-10 Dekel Tsur <dekelts@tau.ac.il>
+
+ * text.C (PrepareToPrint): RTL Fix.
+
+ * paragraph.C (GetUChar): New method.
+ (String): Use GetUChar.
+
+ * buffer.C (asciiParagraph): Use GetUChar.
+
2001-02-09 Dekel Tsur <dekelts@tau.ac.il>
* text.C (GetVisibleRow): Fix selection drawing for RTL text in tables.
} else {
islatex = 0;
}
- c = par->GetChar(i);
+ c = par->GetUChar(params, i);
if (islatex)
continue;
switch (c) {
+2001-02-10 Dekel Tsur <dekelts@tau.ac.il>
+
+ * insettext.C (LocalDispatch): Restore the language if the inset
+ becomes empty.
+
2001-02-09 Dekel Tsur <dekelts@tau.ac.il>
* insettext.C (moveRightIntern): Update the selection cursor.
result = UNDISPATCHED;
break;
}
+
+ /// If the action has deleted all text in the inset, we need to change the
+ // language to the language to the surronding text.
+ if (par->Last() == 0 && !par->next) {
+ LyXFont font(LyXFont::ALL_IGNORE);
+ font.setLanguage(bv->getParentLanguage(this));
+ SetFont(bv, font, false);
+ }
+
if (result != FINISHED) {
ShowInsetCursor(bv);
} else
LyXFont const getFont(BufferParams const &, size_type pos) const;
///
value_type GetChar(size_type pos) const;
+ ///
+ value_type GetUChar(BufferParams const &, size_type pos) const;
/// The position must already exist.
void SetChar(size_type pos, value_type c) {
#ifndef HAVE_ROPE
+2001-02-10 Dekel Tsur <dekelts@tau.ac.il>
+
+ * Many files: add support for the align environment from amsmath.
+
2001-02-09 André Pönitz <poenitz@htwm.de>
* array.h: replace array buffer 'byte bf[]' by 'std::vector<byte> bf'
cols = 1;
switch (type) {
+ case LM_OT_ALIGN:
+ case LM_OT_ALIGNN:
+ columns = 2*cols;
+ for (int i = 0; i < cols; ++i)
+ align += "Rl";
+ break;
case LM_OT_ALIGNAT:
case LM_OT_ALIGNATN:
columns = 2*cols;
short int type = LM_OT_MPAR;
int cols = 1;
if (c >= '1' && c <= '9') {
+ type = LM_OT_ALIGN;
+ cols = c - '1' + 1;
+ } else if (c >= 'A' && c <= 'I') {
type = LM_OT_ALIGNAT;
- cols = c - '0';
+ cols = c - 'A' + 1;
} else if (c == 'm')
type = LM_OT_MULTLINE;
else if (c == 'e')
/// A multiline numbered paragraph
LM_OT_MPARN,
///
+ LM_OT_ALIGN,
+ ///
+ LM_OT_ALIGNN,
+ ///
LM_OT_ALIGNAT,
///
LM_OT_ALIGNATN,
inline
bool is_multi_numbered(short int type)
{
- return type == LM_OT_MPARN || type == LM_OT_ALIGNATN;
+ return type == LM_OT_MPARN || type == LM_OT_ALIGNN
+ || type == LM_OT_ALIGNATN;
}
inline
inline
bool is_multicolumn(short int type)
{
- return type == LM_OT_ALIGNAT || type == LM_OT_ALIGNATN;
+ return type == LM_OT_ALIGN || type == LM_OT_ALIGNN
+ || type == LM_OT_ALIGNAT || type == LM_OT_ALIGNATN;
}
#endif
}
descent = h - ascent + 2;
-
+ // Increase ws[i] for 'R' columns (except the first one)
+ for (i = 1; i < nc; ++i)
+ if (h_align[i] == 'R')
+ ws[i] += 10*df_width;
+
// Adjust local tabs
cxrow = row;
width = MATH_COLSEP;
isvoid = true;
}
switch (h_align[i]) {
- case 'l': lf = 0; break;
- case 'c': lf = (ws[i] - cxrow->getTab(i))/2;
- break;
- case 'r': lf = ws[i] - cxrow->getTab(i); break;
+ case 'l':
+ lf = 0;
+ break;
+ case 'c':
+ lf = (ws[i] - cxrow->getTab(i))/2;
+ break;
+ case 'r':
+ case 'R':
+ lf = ws[i] - cxrow->getTab(i);
+ break;
}
- ww = (isvoid) ? lf: lf + cxrow->getTab(i);
+ ww = (isvoid) ? lf : lf + cxrow->getTab(i);
cxrow->setTab(i, lf + rg);
rg = ws[i] - ww + MATH_COLSEP;
if (cxrow == row) width += ws[i] + MATH_COLSEP;
string mathed_label;
-int const latex_mathenv_num = 10;
+int const latex_mathenv_num = 12;
char const * latex_mathenv[latex_mathenv_num] = {
"math",
"displaymath",
"equation",
"eqnarray*",
"eqnarray",
+ "align*",
+ "align",
"alignat*",
"alignat",
"multline*",
if (is_multiline(mathed_env)) {
int cols = 1;
if (is_multicolumn(mathed_env)) {
+ if (mathed_env != LM_OT_ALIGNAT &&
+ mathed_env != LM_OT_ALIGNATN &&
+ yyis->good()) {
+ char c;
+ yyis->get(c);
+ if (c != '%')
+ lyxerr << "Math parse error: unexpected '"
+ << c << "'" << endl;
+ }
LexGetArg('{');
cols = strToInt(string(yytext));
}
os << "\\begin{"
<< latex_mathenv[mathed_env]
<< "}";
- if (mathed_env == LM_OT_ALIGNAT || mathed_env == LM_OT_ALIGNATN)
+ if (is_multicolumn(mathed_env)) {
+ if (mathed_env != LM_OT_ALIGNAT
+ && mathed_env != LM_OT_ALIGNATN)
+ os << "%";
os << "{" << p->GetColumns()/2 << "}";
+ }
os << "\n";
}
++number_of_newlines;
}
+LyXParagraph::value_type
+LyXParagraph::GetUChar(BufferParams const & bparams,
+ LyXParagraph::size_type pos) const
+{
+ value_type c = GetChar(pos);
+ if (!lyxrc.rtl_support)
+ return c;
+
+ value_type uc = c;
+ switch (c) {
+ case '(':
+ uc = ')';
+ break;
+ case ')':
+ uc = '(';
+ break;
+ case '[':
+ uc = ']';
+ break;
+ case ']':
+ uc = '[';
+ break;
+ case '{':
+ uc = '}';
+ break;
+ case '}':
+ uc = '{';
+ break;
+ case '<':
+ uc = '>';
+ break;
+ case '>':
+ uc = '<';
+ break;
+ }
+ if (uc != c && GetFontSettings(bparams, pos).isRightToLeft())
+ return uc;
+ else
+ return c;
+}
+
// return an string of the current word, and the end of the word in lastpos.
string const LyXParagraph::GetWord(LyXParagraph::size_type & lastpos) const
{
s += labelstring + ' ';
for (LyXParagraph::size_type i = beg; i < end; ++i) {
- value_type c = GetChar(i);
+ value_type c = GetUChar(buffer->params, i);
if (IsPrintable(c))
s += c;
else if (c == META_INSET) {
bool const is_rtl =
row->par()->isRightToLeftPar(bview->buffer()->params);
-#ifndef NEW_INSETS
-
if (is_rtl) {
- x = RightMargin(bview->buffer(), row);
+ x = (workWidth(bview) > 0)
+ ? RightMargin(bview->buffer(), row) : 0;
+#ifndef NEW_INSETS
if (row->par()->footnoteflag == LyXParagraph::OPEN_FOOTNOTE) {
LyXFont font(LyXFont::ALL_SANE);
font.setSize(LyXFont::SIZE_SMALL);
x += lyxfont::width("Mwide-figM", font);
}
- } else
#endif
- if (workWidth(bview) > 0)
- x = LeftMargin(bview, row);
- else
- x = 0;
+ } else
+ x = (workWidth(bview) > 0) ? LeftMargin(bview, row) : 0;
// is there a manual margin with a manual label
if (textclasslist.Style(bview->buffer()->params.textclass,