]> git.lyx.org Git - lyx.git/blob - src/mathed/InsetMathFrac.cpp
Allow using \binom without amsmath and add support for \brace and \brack
[lyx.git] / src / mathed / InsetMathFrac.cpp
1 /**
2  * \file InsetMathFracBase.cpp
3  * This file is part of LyX, the document processor.
4  * Licence details can be found in the file COPYING.
5  *
6  * \author Alejandro Aguilar Sierra
7  * \author André Pönitz
8  *
9  * Full author contact details are available in file CREDITS.
10  */
11
12 #include <config.h>
13
14 #include "InsetMathFrac.h"
15
16 #include "Cursor.h"
17 #include "LaTeXFeatures.h"
18 #include "MathData.h"
19 #include "MathStream.h"
20 #include "MathSupport.h"
21 #include "MetricsInfo.h"
22 #include "TextPainter.h"
23
24 #include "frontends/Painter.h"
25
26 using namespace std;
27
28 namespace lyx {
29
30 /////////////////////////////////////////////////////////////////////
31 //
32 // InsetMathFracBase
33 //
34 /////////////////////////////////////////////////////////////////////
35
36
37 InsetMathFracBase::InsetMathFracBase(idx_type ncells)
38         : InsetMathNest(ncells)
39 {}
40
41
42 bool InsetMathFracBase::idxUpDown(Cursor & cur, bool up) const
43 {
44         InsetMath::idx_type target = !up; // up ? 0 : 1, since upper cell has idx 0
45         if (cur.idx() == target)
46                 return false;
47         cur.idx() = target;
48         cur.pos() = cell(target).x2pos(&cur.bv(), cur.x_target());
49         return true;
50 }
51
52
53
54 /////////////////////////////////////////////////////////////////////
55 //
56 // InsetMathFrac
57 //
58 /////////////////////////////////////////////////////////////////////
59
60
61 InsetMathFrac::InsetMathFrac(Kind kind, InsetMath::idx_type ncells)
62         : InsetMathFracBase(ncells), kind_(kind)
63 {}
64
65
66 Inset * InsetMathFrac::clone() const
67 {
68         return new InsetMathFrac(*this);
69 }
70
71
72 InsetMathFrac * InsetMathFrac::asFracInset()
73 {
74         return kind_ == ATOP ? 0 : this;
75 }
76
77
78 InsetMathFrac const * InsetMathFrac::asFracInset() const
79 {
80         return kind_ == ATOP ? 0 : this;
81 }
82
83
84 bool InsetMathFrac::idxForward(Cursor & cur) const
85 {
86         InsetMath::idx_type target = 0;
87         if (kind_ == UNIT || (kind_ == UNITFRAC && nargs() == 3)) {
88                 if (nargs() == 3)
89                         target = 0;
90                 else if (nargs() == 2)
91                         target = 1;
92         } else
93                 return false;
94         if (cur.idx() == target)
95                 return false;
96         cur.idx() = target;
97         cur.pos() = cell(target).x2pos(&cur.bv(), cur.x_target());
98         return true;
99 }
100
101
102 bool InsetMathFrac::idxBackward(Cursor & cur) const
103 {
104         InsetMath::idx_type target = 0;
105         if (kind_ == UNIT || (kind_ == UNITFRAC && nargs() == 3)) {
106                 if (nargs() == 3)
107                         target = 2;
108                 else if (nargs() == 2)
109                         target = 0;
110         } else
111                 return false;
112         if (cur.idx() == target)
113                 return false;
114         cur.idx() = target;
115         cur.pos() = cell(target).x2pos(&cur.bv(), cur.x_target());
116         return true;
117 }
118
119
120 void InsetMathFrac::metrics(MetricsInfo & mi, Dimension & dim) const
121 {
122         Dimension dim0, dim1, dim2;
123
124         if (kind_ == UNIT || (kind_ == UNITFRAC && nargs() == 3)) {
125                 if (nargs() == 1) {
126                         ShapeChanger dummy2(mi.base.font, UP_SHAPE);
127                         cell(0).metrics(mi, dim0);
128                         dim.wid = dim0.width()+ 3;
129                         dim.asc = dim0.asc;
130                         dim.des = dim0.des;
131                 } else if (nargs() == 2) {
132                         cell(0).metrics(mi, dim0);
133                         ShapeChanger dummy2(mi.base.font, UP_SHAPE);
134                         cell(1).metrics(mi, dim1);
135                         dim.wid = dim0.width() + dim1.wid + 5;
136                         dim.asc = max(dim0.asc, dim1.asc);
137                         dim.des = max(dim0.des, dim1.des);
138                 } else {
139                         cell(2).metrics(mi, dim2);
140                         ShapeChanger dummy2(mi.base.font, UP_SHAPE);
141                         FracChanger dummy(mi.base);
142                         cell(0).metrics(mi, dim0);
143                         cell(1).metrics(mi, dim1);
144                         dim.wid = dim0.width() + dim1.wid + dim2.wid + 10;
145                         dim.asc = max(dim2.asc, dim0.height() + 5);
146                         dim.des = max(dim2.des, dim1.height() - 5);
147                 }
148         } else {
149                 FracChanger dummy(mi.base);
150                 cell(0).metrics(mi, dim0);
151                 cell(1).metrics(mi, dim1);
152                 if (nargs() == 3)
153                         cell(2).metrics(mi, dim2);
154
155                 if (kind_ == NICEFRAC) {
156                         dim.wid = dim0.width() + dim1.wid + 5;
157                         dim.asc = dim0.height() + 5;
158                         dim.des = dim1.height() - 5;
159                 } else if (kind_ == UNITFRAC) {
160                         ShapeChanger dummy2(mi.base.font, UP_SHAPE);
161                         dim.wid = dim0.width() + dim1.wid + 5;
162                         dim.asc = dim0.height() + 5;
163                         dim.des = dim1.height() - 5;
164                 } else {
165                         dim.wid = max(dim0.width(), dim1.wid) + 2;
166                         dim.asc = dim0.height() + 2 + 5;
167                         dim.des = dim1.height() + 2 - 5;
168                 }
169         }
170         metricsMarkers(dim);
171 }
172
173
174 void InsetMathFrac::draw(PainterInfo & pi, int x, int y) const
175 {
176         setPosCache(pi, x, y);
177         Dimension const dim = dimension(*pi.base.bv);
178         Dimension const dim0 = cell(0).dimension(*pi.base.bv);
179         int m = x + dim.wid / 2;
180         if (kind_ == UNIT || (kind_ == UNITFRAC && nargs() == 3)) {
181                 if (nargs() == 1) {
182                         ShapeChanger dummy2(pi.base.font, UP_SHAPE);
183                         cell(0).draw(pi, x + 1, y);
184                 } else if (nargs() == 2) {
185                         cell(0).draw(pi, x + 1, y);
186                         ShapeChanger dummy2(pi.base.font, UP_SHAPE);
187                         cell(1).draw(pi, x + dim0.width() + 5, y);
188                 } else {
189                         cell(2).draw(pi, x + 1, y);
190                         ShapeChanger dummy2(pi.base.font, UP_SHAPE);
191                         FracChanger dummy(pi.base);
192                         Dimension const dim1 = cell(1).dimension(*pi.base.bv);
193                         Dimension const dim2 = cell(2).dimension(*pi.base.bv);
194                         int xx = x + dim2.wid + 5;
195                         cell(0).draw(pi, xx + 2, 
196                                          y - dim0.des - 5);
197                         cell(1).draw(pi, xx  + dim0.width() + 5, 
198                                          y + dim1.asc / 2);
199                 }
200         } else {
201                 FracChanger dummy(pi.base);
202                 Dimension const dim1 = cell(1).dimension(*pi.base.bv);
203                 if (kind_ == NICEFRAC) {
204                         cell(0).draw(pi, x + 2,
205                                         y - dim0.des - 5);
206                         cell(1).draw(pi, x + dim0.width() + 5,
207                                         y + dim1.asc / 2);
208                 } else if (kind_ == UNITFRAC) {
209                         ShapeChanger dummy2(pi.base.font, UP_SHAPE);
210                         cell(0).draw(pi, x + 2,
211                                         y - dim0.des - 5);
212                         cell(1).draw(pi, x + dim0.width() + 5,
213                                         y + dim1.asc / 2);
214                 } else {
215                         // Classical fraction
216                         cell(0).draw(pi, m - dim0.width() / 2,
217                                         y - dim0.des - 2 - 5);
218                         cell(1).draw(pi, m - dim1.wid / 2,
219                                         y + dim1.asc  + 2 - 5);
220                 }
221         }
222         if (kind_ == NICEFRAC || kind_ == UNITFRAC) {
223                 // Diag line:
224                 int xx = x;
225                 if (nargs() == 3)
226                         xx += cell(2).dimension(*pi.base.bv).wid + 5;
227
228                 pi.pain.line(xx + dim0.wid,
229                                 y + dim.des - 2,
230                                 xx + dim0.wid + 5,
231                                 y - dim.asc + 2, Color_math);
232         }
233         if (kind_ == FRAC || kind_ == OVER)
234                 pi.pain.line(x + 1, y - 5,
235                                 x + dim.wid - 2, y - 5, Color_math);
236         drawMarkers(pi, x, y);
237 }
238
239
240 void InsetMathFrac::metricsT(TextMetricsInfo const & mi, Dimension & dim) const
241 {
242         Dimension dim0, dim1;
243         cell(0).metricsT(mi, dim0);
244         cell(1).metricsT(mi, dim1);
245         dim.wid = max(dim0.width(), dim1.wid);
246         dim.asc = dim0.height() + 1;
247         dim.des = dim1.height();
248 }
249
250
251 void InsetMathFrac::drawT(TextPainter & /*pain*/, int /*x*/, int /*y*/) const
252 {
253         // FIXME: BROKEN!
254         /*
255         Dimension dim;
256         int m = x + dim.width() / 2;
257         cell(0).drawT(pain, m - dim0.width() / 2, y - dim0.des - 1);
258         cell(1).drawT(pain, m - dim1.wid / 2, y + dim1.asc);
259         // ASCII art: ignore niceties
260         if (kind_ == FRAC || kind_ == OVER || kind_ == NICEFRAC || kind_ == UNITFRAC)
261                 pain.horizontalLine(x, y, dim.width());
262         */
263 }
264
265
266 void InsetMathFrac::write(WriteStream & os) const
267 {
268         switch (kind_) {
269         case ATOP:
270                 os << '{' << cell(0) << "\\atop " << cell(1) << '}';
271                 break;
272         case OVER:
273                 // \\over is only for compatibility, normalize this to \\frac
274                 os << "\\frac{" << cell(0) << "}{" << cell(1) << '}';
275                 break;
276         case FRAC:
277         case NICEFRAC:
278         case UNITFRAC:
279                 if (nargs() == 2)
280                         InsetMathNest::write(os);
281                 else
282                         os << "\\unitfrac[" << cell(2) << "]{" << cell(0) << "}{" << cell(1) << '}';
283                 break;
284         case UNIT:
285                 if (nargs() == 2)
286                         os << "\\unit[" << cell(0) << "]{" << cell(1) << '}';
287                 else
288                         os << "\\unit{" << cell(0) << '}';
289                 break;
290         }
291 }
292
293
294 docstring InsetMathFrac::name() const
295 {
296         switch (kind_) {
297         case FRAC:
298                 return from_ascii("frac");
299         case OVER:
300                 return from_ascii("over");
301         case NICEFRAC:
302                 return from_ascii("nicefrac");
303         case UNITFRAC:
304                 return from_ascii("unitfrac");
305         case UNIT:
306                 return from_ascii("unit");
307         case ATOP:
308                 return from_ascii("atop");
309         }
310         // shut up stupid compiler
311         return docstring();
312 }
313
314
315 bool InsetMathFrac::extraBraces() const
316 {
317         return kind_ == ATOP || kind_ == OVER;
318 }
319
320
321 void InsetMathFrac::maple(MapleStream & os) const
322 {
323         os << '(' << cell(0) << ")/(" << cell(1) << ')';
324 }
325
326
327 void InsetMathFrac::mathematica(MathematicaStream & os) const
328 {
329         os << '(' << cell(0) << ")/(" << cell(1) << ')';
330 }
331
332
333 void InsetMathFrac::octave(OctaveStream & os) const
334 {
335         os << '(' << cell(0) << ")/(" << cell(1) << ')';
336 }
337
338
339 void InsetMathFrac::mathmlize(MathStream & os) const
340 {
341         os << MTag("mfrac") << cell(0) << cell(1) << ETag("mfrac");
342 }
343
344
345 void InsetMathFrac::validate(LaTeXFeatures & features) const
346 {
347         if (kind_ == NICEFRAC || kind_ == UNITFRAC || kind_ == UNIT)
348                 features.require("units");
349         InsetMathNest::validate(features);
350 }
351
352
353 /////////////////////////////////////////////////////////////////////
354 //
355 // InsetMathDFrac
356 //
357 /////////////////////////////////////////////////////////////////////
358
359
360 Inset * InsetMathDFrac::clone() const
361 {
362         return new InsetMathDFrac(*this);
363 }
364
365
366 void InsetMathDFrac::metrics(MetricsInfo & mi, Dimension & dim) const
367 {
368         Dimension dim0, dim1;
369         cell(0).metrics(mi, dim0);
370         cell(1).metrics(mi, dim1);
371         dim.wid = max(dim0.wid, dim1.wid) + 2;
372         dim.asc = dim0.height() + 2 + 5;
373         dim.des = dim1.height() + 2 - 5;
374 }
375
376
377 void InsetMathDFrac::draw(PainterInfo & pi, int x, int y) const
378 {
379         Dimension const dim = dimension(*pi.base.bv);
380         Dimension const & dim0 = cell(0).dimension(*pi.base.bv);
381         Dimension const & dim1 = cell(1).dimension(*pi.base.bv);
382         int m = x + dim.wid / 2;
383         cell(0).draw(pi, m - dim0.wid / 2, y - dim0.des - 2 - 5);
384         cell(1).draw(pi, m - dim1.wid / 2, y + dim1.asc  + 2 - 5);
385         pi.pain.line(x + 1, y - 5, x + dim.wid - 2, y - 5, Color_math);
386         setPosCache(pi, x, y);
387 }
388
389
390 docstring InsetMathDFrac::name() const
391 {
392         return from_ascii("dfrac");
393 }
394
395
396 void InsetMathDFrac::mathmlize(MathStream & os) const
397 {
398         os << MTag("mdfrac") << cell(0) << cell(1) << ETag("mdfrac");
399 }
400
401
402 void InsetMathDFrac::validate(LaTeXFeatures & features) const
403 {
404         features.require("amsmath");
405         InsetMathNest::validate(features);
406 }
407
408
409 /////////////////////////////////////////////////////////////////////
410 //
411 // InsetMathTFrac
412 //
413 /////////////////////////////////////////////////////////////////////
414
415
416 Inset * InsetMathTFrac::clone() const
417 {
418         return new InsetMathTFrac(*this);
419 }
420
421
422 void InsetMathTFrac::metrics(MetricsInfo & mi, Dimension & dim) const
423 {
424         StyleChanger dummy(mi.base, LM_ST_SCRIPT);
425         Dimension dim0;
426         cell(0).metrics(mi, dim0);
427         Dimension dim1;
428         cell(1).metrics(mi, dim1);
429         dim.wid = max(dim0.width(), dim1.width()) + 2;
430         dim.asc = dim0.height() + 2 + 5;
431         dim.des = dim1.height() + 2 - 5;
432 }
433
434
435 void InsetMathTFrac::draw(PainterInfo & pi, int x, int y) const
436 {
437         StyleChanger dummy(pi.base, LM_ST_SCRIPT);
438         Dimension const dim = dimension(*pi.base.bv);
439         Dimension const & dim0 = cell(0).dimension(*pi.base.bv);
440         Dimension const & dim1 = cell(1).dimension(*pi.base.bv);
441         int m = x + dim.wid / 2;
442         cell(0).draw(pi, m - dim0.width() / 2, y - dim0.descent() - 2 - 5);
443         cell(1).draw(pi, m - dim1.width() / 2, y + dim1.ascent()  + 2 - 5);
444         pi.pain.line(x + 1, y - 5, x + dim.wid - 2, y - 5, Color_math);
445         setPosCache(pi, x, y);
446 }
447
448
449 docstring InsetMathTFrac::name() const
450 {
451         return from_ascii("tfrac");
452 }
453
454
455 void InsetMathTFrac::mathmlize(MathStream & os) const
456 {
457         os << MTag("mtfrac") << cell(0) << cell(1) << ETag("mtfrac");
458 }
459
460
461 void InsetMathTFrac::validate(LaTeXFeatures & features) const
462 {
463         features.require("amsmath");
464         InsetMathNest::validate(features);
465 }
466
467
468 /////////////////////////////////////////////////////////////////////
469 //
470 // InsetMathBinom
471 //
472 /////////////////////////////////////////////////////////////////////
473
474
475 InsetMathBinom::InsetMathBinom(Kind kind)
476         : kind_(kind)
477 {}
478
479
480 Inset * InsetMathBinom::clone() const
481 {
482         return new InsetMathBinom(*this);
483 }
484
485
486 int InsetMathBinom::dw(int height) const
487 {
488         int w = height / 5;
489         if (w > 15)
490                 w = 15;
491         if (w < 6)
492                 w = 6;
493         return w;
494 }
495
496
497 void InsetMathBinom::metrics(MetricsInfo & mi, Dimension & dim) const
498 {
499         FracChanger dummy(mi.base);
500         Dimension dim0, dim1;
501         cell(0).metrics(mi, dim0);
502         cell(1).metrics(mi, dim1);
503         dim.asc = dim0.height() + 4 + 5;
504         dim.des = dim1.height() + 4 - 5;
505         dim.wid = max(dim0.width(), dim1.wid) + 2 * dw(dim.height()) + 4;
506         metricsMarkers2(dim);
507 }
508
509
510 void InsetMathBinom::draw(PainterInfo & pi, int x, int y) const
511 {
512         Dimension const dim = dimension(*pi.base.bv);
513         Dimension const & dim0 = cell(0).dimension(*pi.base.bv);
514         Dimension const & dim1 = cell(1).dimension(*pi.base.bv);
515         docstring const bra = kind_ == BRACE ? from_ascii("{") :
516                               kind_ == BRACK ? from_ascii("[") : from_ascii("(");
517         docstring const ket = kind_ == BRACE ? from_ascii("}") :
518                               kind_ == BRACK ? from_ascii("]") : from_ascii(")");
519         int m = x + dim.width() / 2;
520         FracChanger dummy(pi.base);
521         cell(0).draw(pi, m - dim0.width() / 2, y - dim0.des - 3 - 5);
522         cell(1).draw(pi, m - dim1.wid / 2, y + dim1.asc  + 3 - 5);
523         mathed_draw_deco(pi, x, y - dim.ascent(), dw(dim.height()), dim.height(), bra);
524         mathed_draw_deco(pi, x + dim.width() - dw(dim.height()), y - dim.ascent(),
525                 dw(dim.height()), dim.height(), ket);
526         drawMarkers2(pi, x, y);
527 }
528
529
530 bool InsetMathBinom::extraBraces() const
531 {
532         return kind_ == CHOOSE || kind_ == BRACE || kind_ == BRACK;
533 }
534
535
536 void InsetMathBinom::write(WriteStream & os) const
537 {
538         switch (kind_) {
539         case BINOM:
540                 os << "\\binom{" << cell(0) << "}{" << cell(1) << '}';
541                 break;
542         case CHOOSE:
543                 os << '{' << cell(0) << " \\choose " << cell(1) << '}';
544                 break;
545         case BRACE:
546                 os << '{' << cell(0) << " \\brace " << cell(1) << '}';
547                 break;
548         case BRACK:
549                 os << '{' << cell(0) << " \\brack " << cell(1) << '}';
550                 break;
551         }
552 }
553
554
555 void InsetMathBinom::normalize(NormalStream & os) const
556 {
557         os << "[binom " << cell(0) << ' ' << cell(1) << ']';
558 }
559
560
561 void InsetMathBinom::validate(LaTeXFeatures & features) const
562 {
563         if (kind_ == BINOM) {
564                 features.require("binom");
565                 InsetMathNest::validate(features);
566         }
567 }
568
569
570 /////////////////////////////////////////////////////////////////////
571 //
572 // InsetMathDBinom
573 //
574 /////////////////////////////////////////////////////////////////////
575
576 Inset * InsetMathDBinom::clone() const
577 {
578         return new InsetMathDBinom(*this);
579 }
580
581
582 int InsetMathDBinom::dw(int height) const
583 {
584         int w = height / 5;
585         if (w > 15)
586                 w = 15;
587         if (w < 6)
588                 w = 6;
589         return w;
590 }
591
592
593 void InsetMathDBinom::metrics(MetricsInfo & mi, Dimension & dim) const
594 {
595         Dimension dim0, dim1;
596         cell(0).metrics(mi, dim0);
597         cell(1).metrics(mi, dim1);
598         dim.asc = dim0.height() + 4 + 5;
599         dim.des = dim1.height() + 4 - 5;
600         dim.wid = max(dim0.width(), dim1.wid) + 2 * dw(dim.height()) + 4;
601         metricsMarkers2(dim);
602 }
603
604
605 void InsetMathDBinom::draw(PainterInfo & pi, int x, int y) const
606 {
607         Dimension const dim = dimension(*pi.base.bv);
608         Dimension const & dim0 = cell(0).dimension(*pi.base.bv);
609         Dimension const & dim1 = cell(1).dimension(*pi.base.bv);
610         int m = x + dim.width() / 2;
611         cell(0).draw(pi, m - dim0.width() / 2, y - dim0.des - 3 - 5);
612         cell(1).draw(pi, m - dim1.wid / 2, y + dim1.asc  + 3 - 5);
613         mathed_draw_deco(pi, x, y - dim.ascent(), dw(dim.height()), dim.height(), from_ascii("("));
614         mathed_draw_deco(pi, x + dim.width() - dw(dim.height()), y - dim.ascent(),
615                 dw(dim.height()), dim.height(), from_ascii(")"));
616         drawMarkers2(pi, x, y);
617 }
618
619
620 docstring InsetMathDBinom::name() const
621 {
622         return from_ascii("dbinom");
623 }
624
625 void InsetMathDBinom::mathmlize(MathStream & os) const
626 {
627         os << MTag("mdbinom") << cell(0) << cell(1) << ETag("mdbinom");
628 }
629
630 void InsetMathDBinom::validate(LaTeXFeatures & features) const
631 {
632         features.require("amsmath");
633         InsetMathNest::validate(features);
634 }
635
636
637 /////////////////////////////////////////////////////////////////////
638 //
639 // InsetMathTBinom
640 //
641 /////////////////////////////////////////////////////////////////////
642
643 Inset * InsetMathTBinom::clone() const
644 {
645         return new InsetMathTBinom(*this);
646 }
647
648
649 int InsetMathTBinom::dw(int height) const
650 {
651         int w = height / 5;
652         if (w > 15)
653                 w = 15;
654         if (w < 6)
655                 w = 6;
656         return w;
657 }
658
659
660 void InsetMathTBinom::metrics(MetricsInfo & mi, Dimension & dim) const
661 {
662         StyleChanger dummy(mi.base, LM_ST_SCRIPT);
663         Dimension dim0, dim1;
664         cell(0).metrics(mi, dim0);
665         cell(1).metrics(mi, dim1);
666         dim.asc = dim0.height() + 4 + 5;
667         dim.des = dim1.height() + 4 - 5;
668         dim.wid = max(dim0.width(), dim1.wid) + 2 * dw(dim.height()) + 4;
669         metricsMarkers2(dim);
670 }
671
672
673 void InsetMathTBinom::draw(PainterInfo & pi, int x, int y) const
674 {
675         StyleChanger dummy(pi.base, LM_ST_SCRIPT);
676         Dimension const dim = dimension(*pi.base.bv);
677         Dimension const & dim0 = cell(0).dimension(*pi.base.bv);
678         Dimension const & dim1 = cell(1).dimension(*pi.base.bv);
679         int m = x + dim.width() / 2;
680         cell(0).draw(pi, m - dim0.width() / 2, y - dim0.des - 3 - 5);
681         cell(1).draw(pi, m - dim1.wid / 2, y + dim1.asc  + 3 - 5);
682         mathed_draw_deco(pi, x, y - dim.ascent(), dw(dim.height()), dim.height(), from_ascii("("));
683         mathed_draw_deco(pi, x + dim.width() - dw(dim.height()), y - dim.ascent(),
684                 dw(dim.height()), dim.height(), from_ascii(")"));
685         drawMarkers2(pi, x, y);
686 }
687
688
689 docstring InsetMathTBinom::name() const
690 {
691         return from_ascii("tbinom");
692 }
693
694 void InsetMathTBinom::mathmlize(MathStream & os) const
695 {
696         os << MTag("mtbinom") << cell(0) << cell(1) << ETag("mtbinom");
697 }
698
699 void InsetMathTBinom::validate(LaTeXFeatures & features) const
700 {
701         features.require("amsmath");
702         InsetMathNest::validate(features);
703 }
704
705 } // namespace lyx