1999-09-27 18:44:28 +00:00
|
|
|
// -*- C++ -*-
|
|
|
|
/* This file is part of
|
1999-11-15 12:01:38 +00:00
|
|
|
* ======================================================
|
1999-10-02 16:21:10 +00:00
|
|
|
*
|
|
|
|
* LyX, The Document Processor
|
|
|
|
*
|
|
|
|
* Copyright 1995 Matthias Ettrich
|
2000-03-16 04:29:22 +00:00
|
|
|
* Copyright 1995-2000 the LyX Team.
|
1999-10-02 16:21:10 +00:00
|
|
|
*
|
1999-11-09 23:52:04 +00:00
|
|
|
* ====================================================== */
|
1999-09-27 18:44:28 +00:00
|
|
|
|
|
|
|
#include <config.h>
|
|
|
|
|
|
|
|
#ifdef __GNUG__
|
|
|
|
#pragma implementation "LaTeXFeatures.h"
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#include "LString.h"
|
1999-10-07 18:44:17 +00:00
|
|
|
#include "debug.h"
|
1999-09-27 18:44:28 +00:00
|
|
|
#include "lyx_sty.h"
|
|
|
|
#include "lyxrc.h"
|
|
|
|
#include "LaTeXFeatures.h"
|
|
|
|
#include "bufferparams.h"
|
|
|
|
#include "layout.h"
|
2000-11-13 15:43:36 +00:00
|
|
|
#include "support/filetools.h"
|
2000-12-29 12:48:02 +00:00
|
|
|
#include "FloatList.h"
|
2001-04-05 12:26:41 +00:00
|
|
|
#include "language.h"
|
2000-12-29 12:48:02 +00:00
|
|
|
|
2000-03-28 02:18:55 +00:00
|
|
|
using std::endl;
|
1999-09-27 18:44:28 +00:00
|
|
|
|
2000-09-27 17:07:33 +00:00
|
|
|
LaTeXFeatures::LaTeXFeatures(BufferParams const & p, LyXTextClass::size_type n)
|
2000-04-10 21:40:13 +00:00
|
|
|
: layout(n, false), params(p)
|
1999-09-27 18:44:28 +00:00
|
|
|
{
|
|
|
|
// packages
|
2000-07-17 14:31:07 +00:00
|
|
|
array = false;
|
1999-09-27 18:44:28 +00:00
|
|
|
color = false;
|
2000-07-31 12:30:10 +00:00
|
|
|
graphics = false; // INSET_GRAPHICS: remove this when InsetFig is thrown.
|
2000-09-14 17:53:12 +00:00
|
|
|
graphicx = false;
|
1999-09-27 18:44:28 +00:00
|
|
|
setspace = false;
|
|
|
|
makeidx = false;
|
|
|
|
verbatim = false;
|
|
|
|
longtable = false;
|
|
|
|
algorithm = false;
|
|
|
|
rotating = false;
|
|
|
|
amssymb = false;
|
|
|
|
latexsym = false;
|
|
|
|
pifont = false;
|
|
|
|
subfigure = false;
|
|
|
|
floatflt = false;
|
|
|
|
url = false;
|
2000-05-19 16:46:01 +00:00
|
|
|
varioref = false;
|
|
|
|
prettyref = false;
|
2000-06-12 11:27:15 +00:00
|
|
|
chess = false;
|
1999-09-27 18:44:28 +00:00
|
|
|
|
|
|
|
// commands
|
|
|
|
lyx = false;
|
|
|
|
lyxline = false;
|
|
|
|
noun = false;
|
|
|
|
lyxarrow = false;
|
|
|
|
|
|
|
|
// quotes
|
|
|
|
quotesinglbase = false;
|
|
|
|
quotedblbase = false;
|
|
|
|
guilsinglleft = false;
|
|
|
|
guilsinglright = false;
|
|
|
|
guillemotleft = false;
|
|
|
|
guillemotright = false;
|
|
|
|
|
|
|
|
// Math mode
|
|
|
|
amsstyle = false;
|
|
|
|
binom = false;
|
|
|
|
boldsymbol = false;
|
|
|
|
|
|
|
|
// special features
|
|
|
|
LyXParagraphIndent = false;
|
|
|
|
NeedLyXFootnoteCode = false;
|
|
|
|
NeedLyXMinipageIndent = false;
|
|
|
|
}
|
|
|
|
|
2000-09-14 17:53:12 +00:00
|
|
|
|
|
|
|
void LaTeXFeatures::require(string const & name)
|
|
|
|
{
|
2000-07-17 14:31:07 +00:00
|
|
|
if (name == "array") {
|
|
|
|
array = true;
|
|
|
|
} else if (name == "color") {
|
2000-06-12 11:27:15 +00:00
|
|
|
color = true;
|
|
|
|
} else if (name == "graphics") {
|
|
|
|
graphicx = true;
|
2000-07-31 12:30:10 +00:00
|
|
|
graphics = true;// INSET_GRAPHICS: remove this when InsetFig is thrown.
|
2000-06-12 11:27:15 +00:00
|
|
|
} else if (name == "setspace") {
|
|
|
|
setspace = true;
|
|
|
|
} else if (name == "makeidx") {
|
|
|
|
makeidx = true;
|
|
|
|
} else if (name == "verbatim") {
|
|
|
|
verbatim = true;
|
|
|
|
} else if (name == "longtable") {
|
|
|
|
longtable = true;
|
|
|
|
} else if (name == "algorithm") {
|
|
|
|
algorithm = true;
|
|
|
|
} else if (name == "rotating") {
|
|
|
|
rotating = true;
|
|
|
|
} else if (name == "amssymb") {
|
|
|
|
amssymb = true;
|
|
|
|
} else if (name == "latexsym") {
|
|
|
|
latexsym = true;
|
|
|
|
} else if (name == "pifont") {
|
|
|
|
pifont = true;
|
|
|
|
} else if (name == "subfigure") {
|
|
|
|
subfigure = true;
|
|
|
|
} else if (name == "floatflt") {
|
|
|
|
floatflt = true;
|
|
|
|
} else if (name == "url") {
|
|
|
|
url = true;
|
|
|
|
} else if (name == "varioref") {
|
|
|
|
varioref = true;
|
|
|
|
} else if (name == "prettyref") {
|
|
|
|
prettyref = true;
|
|
|
|
} else if (name == "chess") {
|
|
|
|
chess = true;
|
|
|
|
} else if (name == "amsstyle") {
|
|
|
|
amsstyle = true;
|
|
|
|
} else if (name == "boldsymbol") {
|
|
|
|
boldsymbol = true;
|
|
|
|
} else if (name == "binom") {
|
|
|
|
binom = true;
|
|
|
|
}
|
|
|
|
}
|
1999-09-27 18:44:28 +00:00
|
|
|
|
2000-09-14 17:53:12 +00:00
|
|
|
|
2001-05-08 17:08:44 +00:00
|
|
|
string const LaTeXFeatures::getPackages() const
|
1999-09-27 18:44:28 +00:00
|
|
|
{
|
2001-05-08 17:08:44 +00:00
|
|
|
ostringstream packages;
|
2000-04-10 21:40:13 +00:00
|
|
|
LyXTextClass const & tclass =
|
|
|
|
textclasslist.TextClass(params.textclass);
|
1999-09-27 18:44:28 +00:00
|
|
|
|
2000-07-17 14:31:07 +00:00
|
|
|
// array-package
|
|
|
|
if (array)
|
2001-05-08 17:08:44 +00:00
|
|
|
packages << "\\usepackage{array}\n";
|
2000-07-17 14:31:07 +00:00
|
|
|
|
1999-09-27 18:44:28 +00:00
|
|
|
// color.sty
|
|
|
|
if (color) {
|
|
|
|
if (params.graphicsDriver == "default")
|
2001-05-08 17:08:44 +00:00
|
|
|
packages << "\\usepackage{color}\n";
|
1999-09-27 18:44:28 +00:00
|
|
|
else
|
2001-05-08 17:08:44 +00:00
|
|
|
packages << "\\usepackage["
|
|
|
|
<< params.graphicsDriver
|
|
|
|
<< "]{color}\n";
|
1999-09-27 18:44:28 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
// makeidx.sty
|
|
|
|
if (makeidx) {
|
1999-11-04 01:40:20 +00:00
|
|
|
if (! tclass.provides(LyXTextClass::makeidx)
|
2000-10-10 12:36:36 +00:00
|
|
|
&& params.language->babel() != "french") // french provides
|
|
|
|
// \index !
|
2001-05-08 17:08:44 +00:00
|
|
|
packages << "\\usepackage{makeidx}\n";
|
|
|
|
packages << "\\makeindex\n";
|
1999-09-27 18:44:28 +00:00
|
|
|
}
|
|
|
|
|
2000-07-31 12:30:10 +00:00
|
|
|
// graphicx.sty
|
|
|
|
if (graphicx && params.graphicsDriver != "none") {
|
|
|
|
if (params.graphicsDriver == "default")
|
2001-05-08 17:08:44 +00:00
|
|
|
packages << "\\usepackage{graphicx}\n";
|
2000-07-31 12:30:10 +00:00
|
|
|
else
|
2001-05-08 17:08:44 +00:00
|
|
|
packages << "\\usepackage["
|
|
|
|
<< params.graphicsDriver
|
|
|
|
<< "]{graphicx}\n";
|
2000-07-31 12:30:10 +00:00
|
|
|
}
|
|
|
|
|
2000-09-14 17:53:12 +00:00
|
|
|
// INSET_GRAPHICS: remove this when InsetFig is thrown.
|
1999-09-27 18:44:28 +00:00
|
|
|
// graphics.sty
|
|
|
|
if (graphics && params.graphicsDriver != "none") {
|
|
|
|
if (params.graphicsDriver == "default")
|
2001-05-08 17:08:44 +00:00
|
|
|
packages << "\\usepackage{graphics}\n";
|
1999-09-27 18:44:28 +00:00
|
|
|
else
|
2001-05-08 17:08:44 +00:00
|
|
|
packages << "\\usepackage["
|
|
|
|
<< params.graphicsDriver
|
|
|
|
<< "]{graphics}\n";
|
1999-09-27 18:44:28 +00:00
|
|
|
}
|
|
|
|
|
2000-06-12 11:27:15 +00:00
|
|
|
// verbatim.sty
|
1999-09-27 18:44:28 +00:00
|
|
|
if (verbatim)
|
2001-05-08 17:08:44 +00:00
|
|
|
packages << "\\usepackage{verbatim}\n";
|
1999-09-27 18:44:28 +00:00
|
|
|
|
|
|
|
if (algorithm) {
|
2001-05-08 17:08:44 +00:00
|
|
|
packages << "\\usepackage{algorithm}\n";
|
1999-09-27 18:44:28 +00:00
|
|
|
}
|
|
|
|
|
2000-06-12 11:27:15 +00:00
|
|
|
// lyxchess.sty
|
|
|
|
if (chess) {
|
2001-05-08 17:08:44 +00:00
|
|
|
packages << "\\usepackage{lyxchess}\n";
|
2000-06-12 11:27:15 +00:00
|
|
|
}
|
|
|
|
|
1999-09-27 18:44:28 +00:00
|
|
|
// setspace.sty
|
2000-04-11 22:55:29 +00:00
|
|
|
if ((params.spacing.getSpace() != Spacing::Single
|
|
|
|
&& !params.spacing.isDefault())
|
1999-09-27 18:44:28 +00:00
|
|
|
|| setspace) {
|
2001-05-08 17:08:44 +00:00
|
|
|
packages << "\\usepackage{setspace}\n";
|
1999-09-27 18:44:28 +00:00
|
|
|
}
|
|
|
|
switch (params.spacing.getSpace()) {
|
2000-04-11 22:55:29 +00:00
|
|
|
case Spacing::Default:
|
1999-09-27 18:44:28 +00:00
|
|
|
case Spacing::Single:
|
|
|
|
// we dont use setspace.sty so dont print anything
|
|
|
|
//packages += "\\singlespacing\n";
|
|
|
|
break;
|
|
|
|
case Spacing::Onehalf:
|
2001-05-08 17:08:44 +00:00
|
|
|
packages << "\\onehalfspacing\n";
|
1999-09-27 18:44:28 +00:00
|
|
|
break;
|
|
|
|
case Spacing::Double:
|
2001-05-08 17:08:44 +00:00
|
|
|
packages << "\\doublespacing\n";
|
1999-09-27 18:44:28 +00:00
|
|
|
break;
|
|
|
|
case Spacing::Other:
|
2001-05-08 17:08:44 +00:00
|
|
|
packages << "\\setstretch{"
|
|
|
|
<< params.spacing.getValue() << "}\n";
|
1999-09-27 18:44:28 +00:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
|
|
|
//longtable.sty
|
|
|
|
if (longtable)
|
2001-05-08 17:08:44 +00:00
|
|
|
packages << "\\usepackage{longtable}\n";
|
1999-09-27 18:44:28 +00:00
|
|
|
|
|
|
|
//rotating.sty
|
|
|
|
if (rotating)
|
2001-05-08 17:08:44 +00:00
|
|
|
packages << "\\usepackage{rotating}\n";
|
1999-09-27 18:44:28 +00:00
|
|
|
|
|
|
|
// amssymb.sty
|
2000-05-05 10:17:05 +00:00
|
|
|
if (amssymb || params.use_amsmath)
|
2001-05-08 17:08:44 +00:00
|
|
|
packages << "\\usepackage{amssymb}\n";
|
1999-09-27 18:44:28 +00:00
|
|
|
|
|
|
|
// latexsym.sty
|
|
|
|
if (latexsym)
|
2001-05-08 17:08:44 +00:00
|
|
|
packages << "\\usepackage{latexsym}\n";
|
1999-09-27 18:44:28 +00:00
|
|
|
|
|
|
|
// pifont.sty
|
|
|
|
if (pifont)
|
2001-05-08 17:08:44 +00:00
|
|
|
packages << "\\usepackage{pifont}\n";
|
1999-09-27 18:44:28 +00:00
|
|
|
|
|
|
|
// subfigure.sty
|
|
|
|
if (subfigure)
|
2001-05-08 17:08:44 +00:00
|
|
|
packages << "\\usepackage{subfigure}\n";
|
1999-09-27 18:44:28 +00:00
|
|
|
|
|
|
|
// floatflt.sty
|
|
|
|
if (floatflt)
|
2001-05-08 17:08:44 +00:00
|
|
|
packages << "\\usepackage{floatflt}\n";
|
1999-09-27 18:44:28 +00:00
|
|
|
|
|
|
|
// url.sty
|
1999-11-04 01:40:20 +00:00
|
|
|
if (url && ! tclass.provides(LyXTextClass::url))
|
2001-05-08 17:08:44 +00:00
|
|
|
packages << "\\IfFileExists{url.sty}{\\usepackage{url}}\n"
|
1999-09-27 18:44:28 +00:00
|
|
|
" {\\newcommand{\\url}{\\texttt}}\n";
|
2000-05-19 16:46:01 +00:00
|
|
|
|
|
|
|
// varioref.sty
|
|
|
|
if (varioref)
|
2001-05-08 17:08:44 +00:00
|
|
|
packages << "\\usepackage{varioref}\n";
|
2000-05-19 16:46:01 +00:00
|
|
|
|
|
|
|
// prettyref.sty
|
|
|
|
if (prettyref)
|
2001-05-08 17:08:44 +00:00
|
|
|
packages << "\\usepackage{prettyref}\n";
|
2000-05-19 16:46:01 +00:00
|
|
|
|
2000-06-28 13:35:52 +00:00
|
|
|
// float.sty
|
2000-12-29 12:48:02 +00:00
|
|
|
// We only need float.sty if we use non builtin floats. This includes
|
|
|
|
// modified table and figure floats. (Lgb)
|
|
|
|
if (!usedFloats.empty()) {
|
|
|
|
bool use_float = false;
|
|
|
|
UsedFloats::const_iterator beg = usedFloats.begin();
|
|
|
|
UsedFloats::const_iterator end = usedFloats.end();
|
|
|
|
for (; beg != end; ++beg) {
|
|
|
|
Floating const & fl = floatList.getType((*beg));
|
|
|
|
if (!fl.type().empty() && !fl.builtin()) {
|
|
|
|
use_float = true;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
if (use_float)
|
2001-05-08 17:08:44 +00:00
|
|
|
packages << "\\usepackage{float}\n";
|
2000-12-29 12:48:02 +00:00
|
|
|
}
|
2000-06-28 13:35:52 +00:00
|
|
|
|
2001-05-08 17:08:44 +00:00
|
|
|
packages << externalPreambles;
|
2000-06-12 11:27:15 +00:00
|
|
|
|
2001-05-08 17:08:44 +00:00
|
|
|
return packages.str().c_str();
|
1999-09-27 18:44:28 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2001-05-08 17:08:44 +00:00
|
|
|
string const LaTeXFeatures::getMacros() const
|
1999-09-27 18:44:28 +00:00
|
|
|
{
|
2001-05-08 17:08:44 +00:00
|
|
|
ostringstream macros;
|
1999-09-27 18:44:28 +00:00
|
|
|
|
|
|
|
// always include this
|
|
|
|
if (true || lyx)
|
2001-05-08 17:08:44 +00:00
|
|
|
macros << lyx_def << '\n';
|
1999-09-27 18:44:28 +00:00
|
|
|
|
|
|
|
if (lyxline)
|
2001-05-08 17:08:44 +00:00
|
|
|
macros << lyxline_def << '\n';
|
1999-09-27 18:44:28 +00:00
|
|
|
|
|
|
|
if (noun) {
|
2001-05-08 17:08:44 +00:00
|
|
|
macros << noun_def << '\n';
|
1999-09-27 18:44:28 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
if (lyxarrow) {
|
2001-05-08 17:08:44 +00:00
|
|
|
macros << lyxarrow_def << '\n';
|
1999-09-27 18:44:28 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
// quotes.
|
|
|
|
if (quotesinglbase)
|
2001-05-08 17:08:44 +00:00
|
|
|
macros << quotesinglbase_def << '\n';
|
1999-09-27 18:44:28 +00:00
|
|
|
if (quotedblbase)
|
2001-05-08 17:08:44 +00:00
|
|
|
macros << quotedblbase_def << '\n';
|
1999-09-27 18:44:28 +00:00
|
|
|
if (guilsinglleft)
|
2001-05-08 17:08:44 +00:00
|
|
|
macros << guilsinglleft_def << '\n';
|
1999-09-27 18:44:28 +00:00
|
|
|
if (guilsinglright)
|
2001-05-08 17:08:44 +00:00
|
|
|
macros << guilsinglright_def << '\n';
|
1999-09-27 18:44:28 +00:00
|
|
|
if (guillemotleft)
|
2001-05-08 17:08:44 +00:00
|
|
|
macros << guillemotleft_def << '\n';
|
1999-09-27 18:44:28 +00:00
|
|
|
if (guillemotright)
|
2001-05-08 17:08:44 +00:00
|
|
|
macros << guillemotright_def << '\n';
|
1999-09-27 18:44:28 +00:00
|
|
|
|
|
|
|
// Math mode
|
|
|
|
if (boldsymbol && !amsstyle)
|
2001-05-08 17:08:44 +00:00
|
|
|
macros << boldsymbol_def << '\n';
|
1999-09-27 18:44:28 +00:00
|
|
|
if (binom && !amsstyle)
|
2001-05-08 17:08:44 +00:00
|
|
|
macros << binom_def << '\n';
|
1999-09-27 18:44:28 +00:00
|
|
|
|
|
|
|
// other
|
|
|
|
if (NeedLyXMinipageIndent)
|
2001-05-08 17:08:44 +00:00
|
|
|
macros << minipageindent_def;
|
1999-09-27 18:44:28 +00:00
|
|
|
if (LyXParagraphIndent)
|
2001-05-08 17:08:44 +00:00
|
|
|
macros << paragraphindent_def;
|
1999-09-27 18:44:28 +00:00
|
|
|
if (NeedLyXFootnoteCode)
|
2001-05-08 17:08:44 +00:00
|
|
|
macros << floatingfootnote_def;
|
1999-09-27 18:44:28 +00:00
|
|
|
|
2000-06-28 13:35:52 +00:00
|
|
|
// floats
|
2001-05-08 17:08:44 +00:00
|
|
|
getFloatDefinitions(macros);
|
|
|
|
|
|
|
|
#if 0
|
2000-06-28 13:35:52 +00:00
|
|
|
// Here we will output the code to create the needed float styles.
|
|
|
|
// We will try to do this as minimal as possible.
|
|
|
|
// \floatstyle{ruled}
|
|
|
|
// \newfloat{algorithm}{htbp}{loa}
|
|
|
|
// \floatname{algorithm}{Algorithm}
|
2001-03-11 03:20:44 +00:00
|
|
|
UsedFloats::const_iterator cit = usedFloats.begin();
|
2000-12-29 12:48:02 +00:00
|
|
|
UsedFloats::const_iterator end = usedFloats.end();
|
2001-03-11 03:20:44 +00:00
|
|
|
ostringstream floats;
|
|
|
|
for (; cit != end; ++cit) {
|
|
|
|
Floating const & fl = floatList.getType((*cit));
|
|
|
|
|
|
|
|
// For builtin floats we do nothing.
|
|
|
|
if (fl.builtin()) continue;
|
2000-12-29 12:48:02 +00:00
|
|
|
|
|
|
|
// We have to special case "table" and "figure"
|
2001-03-11 03:20:44 +00:00
|
|
|
if (fl.type() == "tabular" || fl.type() == "figure") {
|
2000-12-29 12:48:02 +00:00
|
|
|
// Output code to modify "table" or "figure"
|
|
|
|
// but only if builtin == false
|
|
|
|
} else {
|
|
|
|
// The other non builtin floats.
|
2001-03-11 03:20:44 +00:00
|
|
|
|
|
|
|
string type = fl.type();
|
|
|
|
string placement = fl.placement();
|
|
|
|
string ext = fl.ext();
|
|
|
|
string within = fl.within();
|
|
|
|
string style = fl.style();
|
|
|
|
string name = fl.name();
|
|
|
|
floats << "\\floatstyle{" << style << "}\n"
|
|
|
|
<< "\\newfloat{" << type << "}{" << placement
|
|
|
|
<< "}{" << ext << "}";
|
|
|
|
if (!within.empty())
|
|
|
|
floats << "[" << within << "]";
|
|
|
|
floats << "\n"
|
|
|
|
<< "\\floatname{" << type << "}{"
|
|
|
|
<< name << "}\n";
|
|
|
|
|
|
|
|
// What missing here is to code to minimalize the code
|
|
|
|
// outputted so that the same flotastyle will not be
|
|
|
|
// used several times. when the same style is still in
|
|
|
|
// effect. (Lgb)
|
2000-12-29 12:48:02 +00:00
|
|
|
}
|
|
|
|
}
|
2001-03-12 15:49:14 +00:00
|
|
|
macros += floats.str().c_str();
|
2001-05-08 17:08:44 +00:00
|
|
|
#endif
|
|
|
|
|
2001-01-20 14:16:01 +00:00
|
|
|
for (LanguageList::const_iterator cit = UsedLanguages.begin();
|
|
|
|
cit != UsedLanguages.end(); ++cit)
|
|
|
|
if (!(*cit)->latex_options().empty())
|
2001-05-08 17:08:44 +00:00
|
|
|
macros << (*cit)->latex_options() << '\n';
|
2001-01-20 14:16:01 +00:00
|
|
|
if (!params.language->latex_options().empty())
|
2001-05-08 17:08:44 +00:00
|
|
|
macros << params.language->latex_options() << '\n';
|
2001-01-20 14:16:01 +00:00
|
|
|
|
2001-05-08 17:08:44 +00:00
|
|
|
return macros.str().c_str();
|
1999-09-27 18:44:28 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2001-05-08 17:08:44 +00:00
|
|
|
string const LaTeXFeatures::getTClassPreamble() const
|
1999-09-27 18:44:28 +00:00
|
|
|
{
|
|
|
|
// the text class specific preamble
|
2000-04-10 21:40:13 +00:00
|
|
|
LyXTextClass const & tclass =
|
|
|
|
textclasslist.TextClass(params.textclass);
|
2001-05-08 17:08:44 +00:00
|
|
|
ostringstream tcpreamble;
|
|
|
|
|
|
|
|
tcpreamble << tclass.preamble();
|
1999-11-04 01:40:20 +00:00
|
|
|
|
1999-11-09 23:52:04 +00:00
|
|
|
for (unsigned int i = 0; i < tclass.numLayouts(); ++i) {
|
|
|
|
if (layout[i]) {
|
2001-05-08 17:08:44 +00:00
|
|
|
tcpreamble << tclass[i].preamble();
|
1999-11-09 23:52:04 +00:00
|
|
|
}
|
1999-09-27 18:44:28 +00:00
|
|
|
}
|
|
|
|
|
2001-05-08 17:08:44 +00:00
|
|
|
return tcpreamble.str().c_str();
|
1999-09-27 18:44:28 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2001-05-08 17:08:44 +00:00
|
|
|
string const LaTeXFeatures::getIncludedFiles(string const & fname) const
|
2000-07-01 12:54:45 +00:00
|
|
|
{
|
2001-05-08 17:08:44 +00:00
|
|
|
ostringstream sgmlpreamble;
|
|
|
|
string const basename = OnlyPath(fname);
|
2000-11-13 15:43:36 +00:00
|
|
|
|
2000-08-03 21:17:52 +00:00
|
|
|
FileMap::const_iterator end = IncludedFiles.end();
|
2000-10-11 21:06:43 +00:00
|
|
|
for (FileMap::const_iterator fi = IncludedFiles.begin();
|
|
|
|
fi != end; ++fi)
|
2001-05-08 17:08:44 +00:00
|
|
|
sgmlpreamble << "\n<!ENTITY " << fi->first
|
|
|
|
<< (IsSGMLFilename(fi->second) ? " SYSTEM \"" : " \"" )
|
|
|
|
<< MakeRelPath(fi->second,basename) << "\">";
|
2000-07-01 12:54:45 +00:00
|
|
|
|
2001-05-08 17:08:44 +00:00
|
|
|
return sgmlpreamble.str().c_str();
|
2000-07-01 12:54:45 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2001-05-08 17:08:44 +00:00
|
|
|
void LaTeXFeatures::showStruct() const{
|
1999-10-07 18:44:17 +00:00
|
|
|
lyxerr << "LyX needs the following commands when LaTeXing:"
|
2000-04-10 21:40:13 +00:00
|
|
|
<< "\n***** Packages:" << getPackages()
|
|
|
|
<< "\n***** Macros:" << getMacros()
|
|
|
|
<< "\n***** Textclass stuff:" << getTClassPreamble()
|
1999-10-07 18:44:17 +00:00
|
|
|
<< "\n***** done." << endl;
|
1999-09-27 18:44:28 +00:00
|
|
|
}
|
2000-04-10 21:40:13 +00:00
|
|
|
|
|
|
|
|
|
|
|
BufferParams const & LaTeXFeatures::bufferParams() const
|
|
|
|
{
|
|
|
|
return params;
|
|
|
|
}
|
2001-05-08 17:08:44 +00:00
|
|
|
|
|
|
|
|
|
|
|
void LaTeXFeatures::getFloatDefinitions(ostream & os) const
|
|
|
|
{
|
|
|
|
// Here we will output the code to create the needed float styles.
|
|
|
|
// We will try to do this as minimal as possible.
|
|
|
|
// \floatstyle{ruled}
|
|
|
|
// \newfloat{algorithm}{htbp}{loa}
|
|
|
|
// \floatname{algorithm}{Algorithm}
|
|
|
|
UsedFloats::const_iterator cit = usedFloats.begin();
|
|
|
|
UsedFloats::const_iterator end = usedFloats.end();
|
|
|
|
// ostringstream floats;
|
|
|
|
for (; cit != end; ++cit) {
|
|
|
|
Floating const & fl = floatList.getType((*cit));
|
|
|
|
|
|
|
|
// For builtin floats we do nothing.
|
|
|
|
if (fl.builtin()) continue;
|
|
|
|
|
|
|
|
// We have to special case "table" and "figure"
|
|
|
|
if (fl.type() == "tabular" || fl.type() == "figure") {
|
|
|
|
// Output code to modify "table" or "figure"
|
|
|
|
// but only if builtin == false
|
|
|
|
// and that have to be true at this point in the
|
|
|
|
// function.
|
|
|
|
string const type = fl.type();
|
|
|
|
string const placement = fl.placement();
|
|
|
|
string const style = fl.style();
|
|
|
|
if (!style.empty()) {
|
|
|
|
os << "\\floatstyle{" << style << "}\n"
|
|
|
|
<< "\\restylefloat{" << type << "}\n";
|
|
|
|
}
|
|
|
|
if (!placement.empty()) {
|
|
|
|
os << "\\floatplacement{" << type << "}{"
|
|
|
|
<< placement << "}\n";
|
|
|
|
}
|
|
|
|
} else {
|
|
|
|
// The other non builtin floats.
|
|
|
|
|
|
|
|
string const type = fl.type();
|
|
|
|
string const placement = fl.placement();
|
|
|
|
string const ext = fl.ext();
|
|
|
|
string const within = fl.within();
|
|
|
|
string const style = fl.style();
|
|
|
|
string const name = fl.name();
|
|
|
|
os << "\\floatstyle{" << style << "}\n"
|
|
|
|
<< "\\newfloat{" << type << "}{" << placement
|
|
|
|
<< "}{" << ext << "}";
|
|
|
|
if (!within.empty())
|
|
|
|
os << "[" << within << "]";
|
|
|
|
os << "\n"
|
|
|
|
<< "\\floatname{" << type << "}{"
|
|
|
|
<< name << "}\n";
|
|
|
|
|
|
|
|
// What missing here is to code to minimalize the code
|
|
|
|
// outputted so that the same flotastyle will not be
|
|
|
|
// used several times. when the same style is still in
|
|
|
|
// effect. (Lgb)
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|