- os << "\\end{minipage}\n";
- texrow.newline();
- if (par_sep == BufferParams::PARSEP_INDENT) {
- os << "}\n";
- texrow.newline();
- }
- if (par && par->pextra_type != PEXTRA_MINIPAGE) {
- os << "\\medskip\n\n";
- texrow.newline();
- texrow.newline();
- }
- minipage_open = false;
- }
- if (eindent_open) {
- os << "\\end{LyXParagraphIndent}\n";
- texrow.newline();
- }
- if (!(par && (par->pextra_type == PEXTRA_MINIPAGE)
- && par->pextra_hfill)) {
- os << '\n';
- texrow.newline();
- }
- lyxerr[Debug::LATEX] << "TeXEnvironment...done " << par << endl;
- return par; // ale970302
-}
-#else
-LyXParagraph * LyXParagraph::TeXEnvironment(string & file, TexRow & texrow,
- string & foot,
- TexRow & foot_texrow,
- int & foot_count)
-{
- bool eindent_open = false;
- bool foot_this_level = false;
- // flags when footnotetext should be appended to file.
- static bool minipage_open = false;
- static int minipage_open_depth = 0;
- char par_sep = current_view->buffer()->params.paragraph_separation;
-
- lyxerr[Debug::LATEX] << "TeXEnvironment... " << this << endl;
- if (IsDummy())
- lyxerr << "ERROR (LyXParagraph::TeXEnvironment)" << endl;
-
- LyXLayout const & style =
- textclasslist.Style(current_view->buffer()->params.textclass,
- layout);
-
- if (pextra_type == PEXTRA_INDENT) {
- if (!pextra_width.empty()) {
- file += "\\begin{LyXParagraphIndent}{"
- + pextra_width + "}\n";
- } else {
- //float ib = atof(pextra_widthp.c_str())/100;
- // string can't handle floats at present (971109)
- // so I'll do a conversion by hand knowing that
- // the limits are 0.0 to 1.0. ARRae.
- file += "\\begin{LyXParagraphIndent}{";
- switch (pextra_widthp.length()) {
- case 3:
- file += "1.00";
- break;
- case 2:
- file += "0.";
- file += pextra_widthp;
- break;
- case 1:
- file += "0.0";
- file += pextra_widthp;
- }
- file += "\\columnwidth}\n";
- }
- texrow.newline();
- eindent_open = true;
- }
- if ((pextra_type == PEXTRA_MINIPAGE) && !minipage_open) {
- if (pextra_hfill && Previous() &&
- (Previous()->pextra_type == PEXTRA_MINIPAGE)) {
- file += "\\hfill{}\n";
- texrow.newline();
- }
- if (par_sep == BufferParams::PARSEP_INDENT) {
- file += "{\\setlength\\parindent{0pt}\n";
- texrow.newline();
- }
- file += "\\begin{minipage}";
- switch(pextra_alignment) {
- case MINIPAGE_ALIGN_TOP:
- file += "[t]";
- break;
- case MINIPAGE_ALIGN_MIDDLE:
- file += "[m]";
- break;
- case MINIPAGE_ALIGN_BOTTOM:
- file += "[b]";
- break;
- }
- if (!pextra_width.empty()) {
- file += '{';
- file += pextra_width + "}\n";
- } else {
- //float ib = atof(par->pextra_width.c_str())/100;
- // string can't handle floats at present
- // so I'll do a conversion by hand knowing that
- // the limits are 0.0 to 1.0. ARRae.
- file += '{';
- switch (pextra_widthp.length()) {
- case 3:
- file += "1.00";
- break;
- case 2:
- file += "0.";
- file += pextra_widthp;
- break;
- case 1:
- file += "0.0";
- file += pextra_widthp;
- }
- file += "\\columnwidth}\n";
- }
- texrow.newline();
- if (par_sep == BufferParams::PARSEP_INDENT) {
- file += "\\setlength\\parindent{\\LyXMinipageIndent}\n";
- texrow.newline();
- }
- minipage_open = true;
- minipage_open_depth = depth;
- }
-
-#ifdef WITH_WARNINGS
-#warning Define FANCY_FOOTNOTE_CODE to re-enable Allan footnote code
- //I disabled it because it breaks when lists span on several
- //pages (JMarc)
-#endif
- if (style.isEnvironment()){
- if (style.latextype == LATEX_LIST_ENVIRONMENT) {
-#ifdef FANCY_FOOTNOTE_CODE
- if (foot_count < 0) {
- // flag that footnote[mark][text] should be
- // used for any footnotes from now on
- foot_count = 0;
- foot_this_level = true;
- }
-#endif
- file += "\\begin{" + style.latexname() + "}{"
- + labelwidthstring + "}\n";
- } else if (style.labeltype == LABEL_BIBLIO) {
- // ale970405
- file += "\\begin{" + style.latexname() + "}{"
- + bibitemWidthest(current_view->painter())
- + "}\n";
- } else if (style.latextype == LATEX_ITEM_ENVIRONMENT) {
-#ifdef FANCY_FOOTNOTE_CODE
- if (foot_count < 0) {
- // flag that footnote[mark][text] should be
- // used for any footnotes from now on
- foot_count = 0;
- foot_this_level = true;
- }
-#endif
- file += "\\begin{" + style.latexname() + '}'
- + style.latexparam() + '\n';
- } else
- file += "\\begin{" + style.latexname() + '}'
- + style.latexparam() + '\n';
- texrow.newline();
- }
- LyXParagraph * par = this;
- do {
- par = par->TeXOnePar(file, texrow,
- foot, foot_texrow, foot_count);
-
- if (minipage_open && par && !style.isEnvironment() &&
- (par->pextra_type == PEXTRA_MINIPAGE) &&
- par->pextra_start_minipage) {
- file += "\\end{minipage}\n";
- texrow.newline();
- if (par_sep == BufferParams::PARSEP_INDENT) {
- file += "}\n";
- texrow.newline();
- }
- minipage_open = false;
- }
- if (par && par->depth > depth) {
- if (textclasslist.Style(current_view->buffer()->params.textclass,
- par->layout).isParagraph()
- && !par->table
- && !suffixIs(file, "\n\n")) {
- // There should be at least one '\n' already
- // but we need there to be two for Standard
- // paragraphs that are depth-increment'ed to be
- // output correctly. However, tables can
- // also be paragraphs so don't adjust them.
- // ARRae
- file += '\n';
- texrow.newline();
- }
- par = par->TeXDeeper(file, texrow,
- foot, foot_texrow, foot_count);
- }
- if (par && par->layout == layout && par->depth == depth &&
- (par->pextra_type == PEXTRA_MINIPAGE) && !minipage_open) {
- if (par->pextra_hfill && par->Previous() &&
- (par->Previous()->pextra_type == PEXTRA_MINIPAGE)){
- file += "\\hfill{}\n";
- texrow.newline();
- }
- if (par_sep == BufferParams::PARSEP_INDENT) {
- file += "{\\setlength\\parindent{0pt}\n";
- texrow.newline();
- }
- file += "\\begin{minipage}";
- switch(par->pextra_alignment) {
- case MINIPAGE_ALIGN_TOP:
- file += "[t]";
- break;
- case MINIPAGE_ALIGN_MIDDLE:
- file += "[m]";
- break;
- case MINIPAGE_ALIGN_BOTTOM:
- file += "[b]";
- break;
- }
- if (!par->pextra_width.empty()) {
- file += '{';
- file += par->pextra_width;
- file += "}\n";
- } else {
- //float ib = atof(par->pextra_widthp.c_str())/100;
- // string can't handle floats at present
- // so I'll do a conversion by hand knowing that
- // the limits are 0.0 to 1.0. ARRae.
- file += '{';
- switch (par->pextra_widthp.length()) {
- case 3:
- file += "1.00";
- break;
- case 2:
- file += "0.";
- file += par->pextra_widthp;
- break;
- case 1:
- file += "0.0";
- file += par->pextra_widthp;
- }
- file += "\\columnwidth}\n";
- }
- texrow.newline();
- if (par_sep == BufferParams::PARSEP_INDENT) {
- file += "\\setlength\\parindent{\\LyXMinipageIndent}\n";
- texrow.newline();
- }
- minipage_open = true;
- minipage_open_depth = par->depth;
- }
- } while (par
- && par->layout == layout
- && par->depth == depth
- && par->pextra_type == pextra_type);
-
- if (style.isEnvironment()) {
- file += "\\end{" + style.latexname() + '}';
- // maybe this should go after the minipage closes?
- if (foot_this_level) {
- if (foot_count >= 1) {
- if (foot_count > 1) {
- file += "\\addtocounter{footnote}{-";
- file += tostr(foot_count - 1);
- file += '}';
- }
- file += foot;
- texrow += foot_texrow;
- foot.clear();
- foot_texrow.reset();
- foot_count = 0;
- }
- }
- }
- if (minipage_open && (minipage_open_depth == depth) &&
- (!par || par->pextra_start_minipage ||
- par->pextra_type != PEXTRA_MINIPAGE)) {
- file += "\\end{minipage}\n";