+2003-05-22 Angus Leeming <leeming@lyx.org>
+
+ * latexrunparams.h: add fragile and use_babel variables.
+
+ * bufferparams.[Ch] (writeLaTeX): return use_babel.
+ * buffer.C (makeLaTeXFile): store this returned value in
+ runparams.use_babel, thus passing it to the inset::latex methods.
+
+ * paragraph.C (simpleTeXOnePar): no need to pass 'moving_arg' to
+ simpleTeXSpecialChars as it is now stored in runparams.fragile.
+
+ * paragraph_funcs.[Ch] (TeXOnePar, latexParagraphs): TeXOnePar no
+ longer has a fragile arg, as it is stored in runparams.fragile.
+
+ * paragraph_pimpl.[Ch] (simpleTeXSpecialChars): no longer has a
+ moving_arg parameter as the data is stored in runparams.fragile.
+
+ * tabular.[Ch] (TeXLongtableHeaderFooter, TeXRow): no longer have
+ a fragile parameter as the data is stored in runparams.fragile.
+
2003-05-22 Lars Gullik Bjønnes <larsbj@gullik.net>
* paragraph.C (Paragraph): initialize next_par_ and prev_par_
}
// Write the preamble
- params.writeLaTeX(os, features, texrow);
+ runparams.use_babel = params.writeLaTeX(os, features, texrow);
if (only_preamble)
return;
}
-void BufferParams::writeLaTeX(ostream & os, LaTeXFeatures & features,
+bool BufferParams::writeLaTeX(ostream & os, LaTeXFeatures & features,
TexRow & texrow) const
{
os << "\\documentclass";
}
os << lyxpreamble;
+ return use_babel;
}
void BufferParams::setPaperStuff()
///
void writeFile(std::ostream &) const;
- ///
- void writeLaTeX(std::ostream &, LaTeXFeatures &, TexRow &) const;
+ /** \returns true if the babel package is used (interogates
+ the BufferParams and a LyXRC variable).
+ This returned value can then be passed to the insets...
+ */
+ bool writeLaTeX(std::ostream &, LaTeXFeatures &, TexRow &) const;
///
void setPaperStuff();
+2003-05-22 Angus Leeming <leeming@lyx.org>
+
+ * PreviewLoader.C (dumpPreamble): no longer pass a fragile arg to
+ the inset::latex method.
+
2003-05-22 Angus Leeming <leeming@lyx.org>
* PreviewLoader.C (dumpPreamble): the 'nice' param passed to
LatexRunParams runparams;
runparams.flavor = LatexRunParams::LATEX;
runparams.nice = true;
+ runparams.fragile = true;
tmp.makeLaTeXFile(os, buffer_.filePath(), runparams, false, true);
// FIXME! This is a HACK! The proper fix is to control the 'true'
for (; it != end; ++it)
if (it->lyxCode() == Inset::MATHMACRO_CODE)
- it->latex(&buffer_, os, runparams, true, true);
+ it->latex(&buffer_, os, runparams, true);
// All equation lables appear as "(#)" + preview.sty's rendering of
// the label name
+2003-05-22 Angus Leeming <leeming@lyx.org>
+
+ * inset*.[Ch] (latex): no longer has a fragile arg. Data is now passed
+ through the LatexRunParams arg.
+
+ * insetquotes.C (latex): accesses use_babel through the LatexRunParams
+ arg rather than through a global var.
+
2003-05-22 Lars Gullik Bjønnes <larsbj@gullik.net>
* insetspecialchar.C (dimension): use a string.
///
virtual void read(Buffer const *, LyXLex & lex) = 0;
/** returns the number of rows (\n's) of generated tex code.
- fragile == true means, that the inset should take care about
- fragile commands by adding a \protect before.
If the free_spc (freespacing) variable is set, then this inset
is in a free-spacing paragraph.
*/
virtual int latex(Buffer const *, std::ostream &,
LatexRunParams const &,
- bool fragile,
bool free_spc) const = 0;
///
virtual int ascii(Buffer const *,
int InsetBibtex::latex(Buffer const * buffer, ostream & os,
LatexRunParams const & runparams,
- bool /*fragile*/, bool/*fs*/) const
+ bool/*fs*/) const
{
// changing the sequence of the commands
// 1. \bibliographystyle{style}
Inset::Code lyxCode() const { return Inset::BIBTEX_CODE; }
///
int latex(Buffer const *, std::ostream &, LatexRunParams const &,
- bool fragile, bool freespace) const;
+ bool freespace) const;
///
void fillWithBibKeys(Buffer const *,
std::vector<std::pair<string,string> > &) const;
}
-int InsetCaption::latex(Buffer const * buf, ostream & os, LatexRunParams const & runparams,
- bool fragile, bool free_spc) const
+int InsetCaption::latex(Buffer const * buf, ostream & os,
+ LatexRunParams const & runparams,
+ bool free_spc) const
{
// This is a bit too simplistic to take advantage of
// caption options we must add more later. (Lgb)
// \caption{...}, later we will make it take advantage
// of the one of the caption packages. (Lgb)
ostringstream ost;
- int const l = InsetText::latex(buf, ost, runparams, fragile, free_spc);
+ int const l = InsetText::latex(buf, ost, runparams, free_spc);
os << "\\caption{" << ost.str() << "}\n";
return l + 1;
}
virtual void draw(BufferView * bv, LyXFont const & f,
int baseline, float & x) const;
///
- virtual int latex(Buffer const * buf, std::ostream & os, LatexRunParams const &,
- bool fragile, bool free_spc) const;
+ virtual int latex(Buffer const * buf, std::ostream & os,
+ LatexRunParams const &,
+ bool free_spc) const;
///
int ascii(Buffer const * buf, std::ostream & os, int linelen) const;
///
// the \cite command is valid. Eg, the user has natbib enabled, inputs some
// citations and then changes his mind, turning natbib support off. The output
// should revert to \cite[]{}
-int InsetCitation::latex(Buffer const * buffer, ostream & os, LatexRunParams const &,
- bool /*fragile*/, bool/*fs*/) const
+int InsetCitation::latex(Buffer const * buffer, ostream & os,
+ LatexRunParams const &,
+ bool/*fs*/) const
{
os << "\\";
if (buffer->params.use_natbib)
///
int ascii(Buffer const *, std::ostream &, int linelen) const;
///
- int latex(Buffer const *, std::ostream &, LatexRunParams const &, bool, bool) const;
+ int latex(Buffer const *, std::ostream &, LatexRunParams const &,
+ bool) const;
///
dispatch_result localDispatch(FuncRequest const & cmd);
///
int InsetCollapsable::latex(Buffer const * buf, ostream & os,
LatexRunParams const & runparams,
- bool fragile, bool free_spc) const
+ bool free_spc) const
{
- return inset.latex(buf, os, runparams, fragile, free_spc);
+ return inset.latex(buf, os, runparams, free_spc);
}
RESULT localDispatch(FuncRequest const &);
///
int latex(Buffer const *, std::ostream &, LatexRunParams const &,
- bool fragile, bool free_spc) const;
+ bool free_spc) const;
///
int ascii(Buffer const *, std::ostream &, int) const;
///
int InsetCommand::latex(Buffer const *, ostream & os, LatexRunParams const &,
- bool /*fragile*/, bool/*fs*/) const
+ bool/*fs*/) const
{
os << getCommand();
return 0;
/// Can remove one InsetBibKey is modified
void scanCommand(string const & c) { p_.scanCommand(c); };
///
- virtual int latex(Buffer const *, std::ostream &, LatexRunParams const &,
- bool fragile, bool free_spc) const;
+ virtual int latex(Buffer const *, std::ostream &,
+ LatexRunParams const &,
+ bool free_spc) const;
///
int ascii(Buffer const *, std::ostream &, int linelen) const;
///
int InsetEnvironment::latex(Buffer const * buf, ostream & os,
LatexRunParams const & runparams,
- bool fragile, bool) const
+ bool) const
{
os << layout_->latexheader;
TexRow texrow;
- latexParagraphs(buf, paragraphs, os, texrow, runparams, fragile,
- layout_->latexparagraph);
+ latexParagraphs(buf, paragraphs, os, texrow, runparams,
+ layout_->latexparagraph);
os << layout_->latexfooter;
return texrow.rows();
}
Inset::Code lyxCode() const { return Inset::ENVIRONMENT_CODE; }
///
int latex(Buffer const *, std::ostream &, LatexRunParams const &,
- bool fragile, bool fp) const;
+ bool fp) const;
///
string const editMessage() const;
///
void read(Buffer const *, LyXLex &) {}
///
int latex(Buffer const *, std::ostream &, LatexRunParams const &,
- bool, bool) const { return 0; }
+ bool) const { return 0; }
///
int ascii(Buffer const *, std::ostream &, int) const { return 0; }
///
int InsetERT::latex(Buffer const *, ostream & os, LatexRunParams const &,
- bool /*fragile*/, bool /*free_spc*/) const
+ bool /*free_spc*/) const
{
ParagraphList::iterator par = inset.paragraphs.begin();
ParagraphList::iterator end = inset.paragraphs.end();
///
EDITABLE editable() const;
///
- int latex(Buffer const *, std::ostream &, LatexRunParams const &, bool fragile,
+ int latex(Buffer const *, std::ostream &, LatexRunParams const &,
bool free_spc) const;
///
int ascii(Buffer const *,
}
-int InsetExternal::latex(Buffer const * buf, ostream & os, LatexRunParams const &,
- bool, bool) const
+int InsetExternal::latex(Buffer const * buf, ostream & os,
+ LatexRunParams const &,
+ bool) const
{
return write("LaTeX", buf, os);
}
If the free_spc (freespacing) variable is set, then this inset
is in a free-spacing paragraph.
*/
- virtual int latex(Buffer const *, std::ostream &, LatexRunParams const &,
- bool fragile, bool free_spc) const;
+ virtual int latex(Buffer const *, std::ostream &,
+ LatexRunParams const &,
+ bool free_spc) const;
/// write ASCII output to the ostream
virtual int ascii(Buffer const *, std::ostream &, int linelen) const;
/// write LinuxDoc output to the ostream
}
-int InsetFloat::latex(Buffer const * buf, ostream & os, LatexRunParams const & runparams,
- bool fragile, bool fp) const
+int InsetFloat::latex(Buffer const * buf, ostream & os,
+ LatexRunParams const & runparams,
+ bool fp) const
{
FloatList const & floats = buf->params.getLyXTextClass().floats();
string const tmptype = (params_.wide ? params_.type + "*" : params_.type);
}
os << '\n';
- int const i = inset.latex(buf, os, runparams, fragile, fp);
+ int const i = inset.latex(buf, os, runparams, fp);
// The \n is used to force \end{<floatname>} to appear in a new line.
// In this case, we do not case if the current output line is empty.
Inset::Code lyxCode() const { return Inset::FLOAT_CODE; }
///
int latex(Buffer const *, std::ostream &, LatexRunParams const &,
- bool fragile, bool fp) const;
+ bool fp) const;
///
int docbook(Buffer const *, std::ostream &, bool mixcont) const;
///
}
-int InsetFloatList::latex(Buffer const * buf, ostream & os, LatexRunParams const &,
- bool, bool) const
+int InsetFloatList::latex(Buffer const * buf, ostream & os,
+ LatexRunParams const &,
+ bool) const
{
FloatList const & floats = buf->params.getLyXTextClass().floats();
FloatList::const_iterator cit = floats[getCmdName()];
void read(Buffer const *, LyXLex &);
///
int latex(Buffer const *, std::ostream &, LatexRunParams const &,
- bool, bool) const;
+ bool) const;
///
int linuxdoc(Buffer const *, std::ostream &) const { return 0; }
///
#include "gettext.h"
#include "lyxfont.h"
#include "BufferView.h"
+#include "latexrunparams.h"
#include "lyxtext.h"
#include "insets/insettext.h"
#include "support/LOstream.h"
}
-int InsetFoot::latex(Buffer const * buf, ostream & os, LatexRunParams const & runparams,
- bool fragile, bool fp) const
+int InsetFoot::latex(Buffer const * buf, ostream & os,
+ LatexRunParams const & runparams_in,
+ bool fp) const
{
+ LatexRunParams runparams = runparams_in;
if (buf && parOwner()) {
LyXLayout_ptr const & layout = parOwner()->layout();
- fragile |= layout->intitle;
+ runparams.fragile |= layout->intitle;
}
os << "%\n\\footnote{";
- int const i = inset.latex(buf, os, runparams, fragile, fp);
+ int const i = inset.latex(buf, os, runparams, fp);
os << "%\n}";
return i + 2;
Inset::Code lyxCode() const { return Inset::FOOT_CODE; }
///
int latex(Buffer const *, std::ostream &, LatexRunParams const &,
- bool fragile, bool fp) const;
+ bool fp) const;
///
int docbook(Buffer const *, std::ostream &, bool mixcont) const;
///
int InsetGraphics::latex(Buffer const * buf, ostream & os,
LatexRunParams const & runparams,
- bool /*fragile*/, bool/*fs*/) const
+ bool/*fs*/) const
{
// If there is no file specified or not existing,
// just output a message about it in the latex output.
fragile commands by adding a #\protect# before.
*/
int latex(Buffer const *, std::ostream &, LatexRunParams const &,
- bool fragile, bool free_spc) const;
+ bool free_spc) const;
///
int ascii(Buffer const *, std::ostream &, int linelen) const;
///
int InsetHFill::latex(Buffer const *, ostream & os, LatexRunParams const &,
- bool /*fragile*/, bool /*fs*/) const
+ bool /*fs*/) const
{
os << getCommand();
return 0;
Inset::Code lyxCode() const { return Inset::HFILL_CODE; }
///
int latex(Buffer const *, std::ostream &, LatexRunParams const &,
- bool fragile, bool free_spc) const;
+ bool free_spc) const;
///
int ascii(Buffer const *, std::ostream &, int linelen) const;
///
int InsetInclude::latex(Buffer const * buffer, ostream & os,
LatexRunParams const & runparams,
- bool /*fragile*/, bool /*fs*/) const
+ bool /*fs*/) const
{
string incfile(params_.cparams.getContents());
ostringstream os;
LatexRunParams runparams;
runparams.flavor = LatexRunParams::LATEX;
- parent().latex(view()->buffer(), os, runparams, false, false);
+ parent().latex(view()->buffer(), os, runparams, false);
return STRCONV(os.str());
}
void read(Buffer const *, LyXLex &);
///
int latex(Buffer const *, std::ostream &, LatexRunParams const &,
- bool fragile, bool free_spc) const;
+ bool free_spc) const;
///
int ascii(Buffer const *, std::ostream &, int linelen) const;
///
int InsetLabel::latex(Buffer const *, ostream & os, LatexRunParams const &,
- bool /*fragile*/, bool /*fs*/) const
+ bool /*fs*/) const
{
os << escape(getCommand());
return 0;
std::vector<string> const getLabelList() const;
///
int latex(Buffer const *, std::ostream &, LatexRunParams const &,
- bool fragile, bool free_spc) const;
+ bool free_spc) const;
///
int ascii(Buffer const *, std::ostream &, int linelen) const;
///
}
-int InsetLatexAccent::latex(Buffer const *, ostream & os, LatexRunParams const &,
- bool /*fragile*/, bool/*fs*/) const
+int InsetLatexAccent::latex(Buffer const *, ostream & os,
+ LatexRunParams const &,
+ bool/*fs*/) const
{
os << contents;
return 0;
void read(Buffer const *, LyXLex & lex);
///
int latex(Buffer const *, std::ostream &, LatexRunParams const &,
- bool fragile, bool free_spc) const;
+ bool free_spc) const;
///
int ascii(Buffer const *, std::ostream &, int linelen) const;
///
}
-int InsetList::latex(Buffer const * buf,
- ostream & os, bool fragile, bool fp) const
+int InsetList::latex(Buffer const * buf, ostream & os,
+ LatexRunParams const & runparams, bool fp) const
{
os << "\\footnote{%\n";
- int i = inset.latex(buf, os, fragile, fp);
+ int i = inset.latex(buf, os, runparams, fp);
os << "}%\n";
return i + 2;
Inset::Code lyxCode() const { return Inset::FOOT_CODE; }
///
int latex(Buffer const *, std::ostream &, LatexRunParams const &,
- bool fragile, bool fp) const;
+ bool fp) const;
///
string const editMessage() const;
};
}
-int InsetMarginal::latex(Buffer const * buf, ostream & os, LatexRunParams const & runparams,
- bool fragile, bool fp) const
+int InsetMarginal::latex(Buffer const * buf, ostream & os,
+ LatexRunParams const & runparams,
+ bool fp) const
{
os << "%\n\\marginpar{";
- int const i = inset.latex(buf, os, runparams, fragile, fp);
+ int const i = inset.latex(buf, os, runparams, fp);
os << "%\n}";
return i + 2;
Inset::Code lyxCode() const { return Inset::MARGIN_CODE; }
///
int latex(Buffer const *, std::ostream &, LatexRunParams const &,
- bool fragile, bool fp) const;
+ bool fp) const;
///
string const editMessage() const;
};
}
-int InsetMinipage::latex(Buffer const * buf, ostream & os, LatexRunParams const & runparams,
- bool fragile, bool fp) const
+int InsetMinipage::latex(Buffer const * buf, ostream & os,
+ LatexRunParams const & runparams,
+ bool fp) const
{
string s_pos;
switch (params_.pos) {
os << "\\begin{minipage}[" << s_pos << "]{"
<< params_.width.asLatexString() << "}%\n";
- int i = inset.latex(buf, os, runparams, fragile, fp);
+ int i = inset.latex(buf, os, runparams, fp);
os << "\\end{minipage}%\n";
return i + 2;
Inset::Code lyxCode() const { return Inset::MINIPAGE_CODE; }
///
int latex(Buffer const *, std::ostream &, LatexRunParams const &,
- bool fragile, bool fp) const;
+ bool fp) const;
///
string const editMessage() const;
///
int InsetNewline::latex(Buffer const *, ostream &, LatexRunParams const &,
- bool, bool) const
+ bool) const
{
lyxerr << "Eek, calling InsetNewline::latex !" << endl;
return 0;
virtual void draw(BufferView *, LyXFont const &,
int baseline, float & x) const;
- virtual int latex(Buffer const *, std::ostream &, LatexRunParams const &,
- bool fragile, bool free_spc) const;
+ virtual int latex(Buffer const *, std::ostream &,
+ LatexRunParams const &,
+ bool free_spc) const;
virtual int ascii(Buffer const *, std::ostream &, int linelen) const;
void write(Buffer const *, std::ostream &) const;
///
int latex(Buffer const *, std::ostream &, LatexRunParams const &,
- bool, bool) const
+ bool) const
{ return 0; }
///
int linuxdoc(Buffer const *, std::ostream &) const
int InsetOptArg::latex(Buffer const *, ostream &, LatexRunParams const &,
- bool, bool) const
+ bool) const
{
return 0;
}
int InsetOptArg::latexOptional(Buffer const * buf, ostream & os,
- LatexRunParams const & runparams, bool, bool fp) const
+ LatexRunParams const & runparams, bool fp) const
{
os << '[';
- int const i = inset.latex(buf, os, runparams, false, fp);
+ int const i = inset.latex(buf, os, runparams, fp);
os << ']';
return i + 2;
}
/// Standard LaTeX output -- short-circuited
int latex(Buffer const *, std::ostream &, LatexRunParams const &,
- bool fragile, bool fp) const;
+ bool fp) const;
/// Outputting the optional parameter of a LaTeX command
- int latexOptional(Buffer const *, std::ostream &, LatexRunParams const &,
- bool fragile, bool fp) const;
+ int latexOptional(Buffer const *, std::ostream &,
+ LatexRunParams const &,
+ bool fp) const;
/// Write out tothe .lyx file
void write(Buffer const * buf, std::ostream & os) const;
};
// LaTeX must just ignore this command
-int InsetParent::latex(Buffer const * buf, ostream & os, LatexRunParams const & runparams,
- bool fragile, bool free_spc) const
+int InsetParent::latex(Buffer const * buf, ostream & os,
+ LatexRunParams const & runparams,
+ bool free_spc) const
{
os << "%%#{lyx}";
- InsetCommand::latex(buf, os, runparams, fragile, free_spc);
+ InsetCommand::latex(buf, os, runparams, free_spc);
return 0;
}
Inset::Code lyxCode() const { return Inset::PARENT_CODE; }
///
int latex(Buffer const *, std::ostream &, LatexRunParams const &,
- bool fragile, bool free_spc) const;
+ bool free_spc) const;
///
void setParent(string const & fn) { setContents(fn); }
};
#include "insetquotes.h"
-#include "BufferView.h"
-#include "LaTeXFeatures.h"
-#include "frontends/Painter.h"
#include "buffer.h"
+#include "BufferView.h"
#include "debug.h"
#include "dimension.h"
-#include "frontends/font_metrics.h"
#include "language.h"
+#include "LaTeXFeatures.h"
+#include "latexrunparams.h"
#include "lyxfont.h"
+#include "lyxlex.h"
#include "lyxrc.h"
#include "paragraph.h"
-#include "lyxlex.h"
+#include "frontends/font_metrics.h"
+#include "frontends/Painter.h"
#include "support/LAssert.h"
#include "support/lstrings.h"
}
-extern bool use_babel;
-
-int InsetQuotes::latex(Buffer const * buf, ostream & os, LatexRunParams const &,
- bool /*fragile*/, bool /* free_spc */) const
+int InsetQuotes::latex(Buffer const * buf, ostream & os,
+ LatexRunParams const & runparams,
+ bool /* free_spc */) const
{
// How do we get the local language here??
lyx::pos_type curr_pos = parOwner()->getPositionOfInset(this);
#ifdef DO_USE_DEFAULT_LANGUAGE
} else if (doclang == "default") {
#else
- } else if (!use_babel) {
+ } else if (!runparams.use_babel) {
#endif
qstr = latex_quote_ot1[times_][quoteind];
} else {
}
+extern bool use_babel;
+
void InsetQuotes::validate(LaTeXFeatures & features) const
{
char type = quote_char[quote_index[side_][language_]];
void read(Buffer const *, LyXLex & lex);
///
int latex(Buffer const *, std::ostream &, LatexRunParams const &,
- bool fragile, bool free_spc) const;
+ bool free_spc) const;
///
int ascii(Buffer const *, std::ostream &, int linelen) const;
///
int InsetRef::latex(Buffer const *, ostream & os, LatexRunParams const &,
- bool /*fragile*/, bool /*fs*/) const
+ bool /*fs*/) const
{
if (getOptions().empty())
os << escape(getCommand());
bool display() const { return false; }
///
int latex(Buffer const *, std::ostream &, LatexRunParams const &,
- bool fragile, bool free_spc) const;
+ bool free_spc) const;
///
int ascii(Buffer const *, std::ostream &, int linelen) const;
///
int InsetSpace::latex(Buffer const *, ostream & os, LatexRunParams const &,
- bool /*fragile*/, bool free_space) const
+ bool free_space) const
{
switch (kind_) {
case NORMAL:
void read(Buffer const *, LyXLex & lex);
///
int latex(Buffer const *, std::ostream &, LatexRunParams const &,
- bool fragile, bool free_spc) const;
+ bool free_spc) const;
///
int ascii(Buffer const *, std::ostream &, int linelen) const;
///
}
-int InsetSpecialChar::latex(Buffer const *, ostream & os, LatexRunParams const &,
- bool /*fragile*/, bool free_space) const
+int InsetSpecialChar::latex(Buffer const *, ostream & os,
+ LatexRunParams const &,
+ bool free_space) const
{
switch (kind_) {
case HYPHENATION:
void read(Buffer const *, LyXLex & lex);
///
int latex(Buffer const *, std::ostream &, LatexRunParams const &,
- bool fragile, bool free_spc) const;
+ bool free_spc) const;
///
int ascii(Buffer const *, std::ostream &, int linelen) const;
///
}
-int InsetTabular::latex(Buffer const * buf, ostream & os, LatexRunParams const & runparams,
- bool fragile, bool fp) const
+int InsetTabular::latex(Buffer const * buf, ostream & os,
+ LatexRunParams const & runparams,
+ bool fp) const
{
- return tabular->latex(buf, os, runparams, fragile, fp);
+ return tabular->latex(buf, os, runparams, fp);
}
RESULT localDispatch(FuncRequest const &);
///
int latex(Buffer const *, std::ostream &, LatexRunParams const &,
- bool, bool) const;
+ bool) const;
///
int ascii(Buffer const *, std::ostream &, int linelen) const;
///
}
-int InsetText::latex(Buffer const * buf, ostream & os, LatexRunParams const & runparams,
- bool fragile, bool) const
+int InsetText::latex(Buffer const * buf, ostream & os,
+ LatexRunParams const & runparams,
+ bool) const
{
TexRow texrow;
- latexParagraphs(buf, paragraphs, os, texrow, runparams, fragile);
+ latexParagraphs(buf, paragraphs, os, texrow, runparams);
return texrow.rows();
}
RESULT localDispatch(FuncRequest const &);
///
int latex(Buffer const *, std::ostream &, LatexRunParams const &,
- bool fragile, bool free_spc) const;
+ bool free_spc) const;
///
int ascii(Buffer const *, std::ostream &, int linelen) const;
///
}
-int InsetTheorem::latex(Buffer const * buf,
- ostream & os, bool fragile, bool fp) const
+int InsetTheorem::latex(Buffer const * buf, ostream & os,
+ LatexRunParams const & runparams, bool fp) const
{
os << "\\begin{theorem}%\n";
- int i = inset.latex(buf, os, fragile, fp);
+ int i = inset.latex(buf, os, runparams, fp);
os << "\\end{theorem}%\n";
return i + 2;
bool display() const { return true; }
///
int latex(Buffer const *, std::ostream &, LatexRunParams const &,
- bool fragile, bool fp) const;
+ bool fp) const;
///
string const editMessage() const;
};
#include "funcrequest.h"
#include "BufferView.h"
#include "LaTeXFeatures.h"
+#include "latexrunparams.h"
#include "frontends/LyXView.h"
#include "debug.h"
#include "frontends/Dialogs.h"
}
-int InsetUrl::latex(Buffer const *, ostream & os, LatexRunParams const &,
- bool fragile, bool /*free_spc*/) const
+int InsetUrl::latex(Buffer const *, ostream & os,
+ LatexRunParams const & runparams,
+ bool /*free_spc*/) const
{
if (!getOptions().empty())
os << getOptions() + ' ';
- if (fragile)
+ if (runparams.fragile)
os << "\\protect";
os << "\\url{" << getContents() << '}';
return 0;
bool display() const { return false; }
///
int latex(Buffer const *, std::ostream &, LatexRunParams const &,
- bool fragile, bool free_spc) const;
+ bool free_spc) const;
///
int ascii(Buffer const *, std::ostream &, int linelen) const;
///
}
-int InsetWrap::latex(Buffer const * buf, ostream & os, LatexRunParams const & runparams,
- bool fragile, bool fp) const
+int InsetWrap::latex(Buffer const * buf, ostream & os,
+ LatexRunParams const & runparams,
+ bool fp) const
{
os << "\\begin{floating" << params_.type << '}';
if (!params_.placement.empty()) {
}
os << '{' << params_.width.asLatexString() << "}%\n";
- int const i = inset.latex(buf, os, runparams, fragile, fp);
+ int const i = inset.latex(buf, os, runparams, fp);
os << "\\end{floating" << params_.type << "}%\n";
return i + 2;
Inset::Code lyxCode() const { return Inset::WRAP_CODE; }
///
int latex(Buffer const *, std::ostream &, LatexRunParams const &,
- bool fragile, bool fp) const;
+ bool fp) const;
///
int docbook(Buffer const *, std::ostream &, bool mixcont) const;
///
PDFLATEX
};
- LatexRunParams() : flavor(LATEX), nice(false) {}
+ LatexRunParams() : flavor(LATEX), nice(false),
+ fragile(false), use_babel(false) {}
/** The latex that we export depends occasionally on what is to
compile the file.
*/
FLAVOR flavor;
+
/** Are we to write a 'nice' LaTeX file or not.
This esentially seems to mean whether InsetInclude, InsetGraphics
and InsetExternal should add the absolute path to any external
files or not.
*/
bool nice;
+
+ /** fragile == true means that the inset should take care about
+ fragile commands by preceding the latex with \protect.
+ */
+ bool fragile;
+
+ /** This var is set by the return value from BufferParams::writeLaTeX
+ */
+ bool use_babel;
};
-#endif // LatexRunParams_H
+#endif // LATEXRUNPARAMS_H
+2003-05-22 Angus Leeming <leeming@lyx.org>
+
+ * formula.[Ch] (latex):
+ * formulamacro.[Ch] (latex):
+ no longer has a fragile arg. Data is now passed through the
+ LatexRunParams arg.
+
2003-05-22 Angus Leeming <leeming@lyx.org>
* formula.[Ch] (latex):
#include "BufferView.h"
#include "gettext.h"
#include "debug.h"
+#include "latexrunparams.h"
#include "lyxrc.h"
#include "funcrequest.h"
#include "Lsstream.h"
}
-int InsetFormula::latex(Buffer const *, ostream & os, LatexRunParams const &,
- bool fragile, bool) const
+int InsetFormula::latex(Buffer const *, ostream & os,
+ LatexRunParams const & runparams,
+ bool) const
{
- WriteStream wi(os, fragile, true);
+ WriteStream wi(os, runparams.fragile, true);
par_->write(wi);
return wi.line();
}
void read(Buffer const *, LyXLex & lex);
///
int latex(Buffer const *, std::ostream &, LatexRunParams const &,
- bool fragile, bool free_spc) const;
+ bool free_spc) const;
///
int ascii(Buffer const *, std::ostream &, int linelen) const;
///
#include "math_mathmlstream.h"
#include "BufferView.h"
#include "gettext.h"
+#include "latexrunparams.h"
#include "frontends/Painter.h"
#include "frontends/font_metrics.h"
#include "support/lyxlib.h"
}
-int InsetFormulaMacro::latex(Buffer const *, ostream & os, LatexRunParams const &,
- bool fragile, bool /*free_spacing*/) const
+int InsetFormulaMacro::latex(Buffer const *, ostream & os,
+ LatexRunParams const & runparams,
+ bool /*free_spacing*/) const
{
- WriteStream wi(os, fragile, true);
+ WriteStream wi(os, runparams.fragile, true);
par()->write(wi);
return 2;
}
int ascii(Buffer const *, std::ostream &, int linelen) const;
///
int latex(Buffer const *, std::ostream & os, LatexRunParams const &,
- bool fragile, bool free_spc) const;
+ bool free_spc) const;
///
int linuxdoc(Buffer const *, std::ostream & os) const;
///
#include "paragraph.h"
#include "paragraph_pimpl.h"
-#include "lyxrc.h"
-#include "layout.h"
-#include "language.h"
+
#include "buffer.h"
#include "bufferparams.h"
-#include "debug.h"
-#include "texrow.h"
#include "BufferView.h"
+#include "changes.h"
#include "encoding.h"
-#include "ParameterStruct.h"
+#include "debug.h"
#include "gettext.h"
-#include "changes.h"
+#include "language.h"
+#include "latexrunparams.h"
+#include "layout.h"
+#include "lyxrc.h"
#include "paragraph_funcs.h"
+#include "ParameterStruct.h"
+#include "texrow.h"
+
#include "Lsstream.h"
#include "insets/insetbibitem.h"
column += Changes::latexMarkChange(os, running_change, change);
running_change = change;
+ LatexRunParams rp = runparams;
+ rp.fragile = moving_arg;
pimpl_->simpleTeXSpecialChars(buf, bparams,
- os, texrow, runparams, moving_arg,
+ os, texrow, runparams,
font, running_font,
basefont, outerfont, open_font,
running_change,
ParagraphList::iterator pit,
ostream & os, TexRow & texrow,
LatexRunParams const & runparams,
- bool moving_arg,
string const & everypar = string());
InsetOptArg * it = optArgInset(*pit);
if (it)
it->latexOptional(buf, os, runparams,
- false, false);
+ false);
}
else
os << style->latexparam();
ostream & os,
TexRow & texrow,
LatexRunParams const & runparams,
- bool moving_arg,
- string const & everypar)
+ string const & everypar)
{
bool was_title = false;
bool already_title = false;
if (layout->is_environment) {
par = TeXOnePar(buf, paragraphs, par, os, texrow,
- runparams, moving_arg, everypar);
+ runparams, everypar);
} else if (layout->isEnvironment() ||
!par->params().leftIndent().zero())
{
texrow, runparams);
} else {
par = TeXOnePar(buf, paragraphs, par, os, texrow,
- runparams, moving_arg, everypar);
+ runparams, everypar);
}
} else {
par = TeXOnePar(buf, paragraphs, par, os, texrow,
- runparams, moving_arg, everypar);
+ runparams, everypar);
}
}
// It might be that we only have a title in this document
std::ostream & ofs,
TexRow & texrow,
LatexRunParams const &,
- bool moving_arg,
string const & everypar = string());
/// read a paragraph from a .lyx file. Returns number of unrecognised tokens
#include <config.h>
#include "paragraph_pimpl.h"
-#include "LaTeXFeatures.h"
-#include "texrow.h"
-#include "language.h"
+
#include "bufferparams.h"
+#include "debug.h"
#include "encoding.h"
+#include "language.h"
+#include "LaTeXFeatures.h"
+#include "latexrunparams.h"
#include "lyxrc.h"
-#include "debug.h"
#include "paragraph_funcs.h"
+#include "texrow.h"
#include "support/LAssert.h"
ostream & os,
TexRow & texrow,
LatexRunParams const & runparams,
- bool moving_arg,
LyXFont & font,
LyXFont & running_font,
LyXFont & basefont,
if (font.family() == LyXFont::TYPEWRITER_FAMILY)
os << '~';
- if (moving_arg)
+ if (runparams.fragile)
os << "\\protect ";
os << "\\\\\n";
running_font = basefont;
}
- int tmp = inset->latex(buf, os, runparams, moving_arg,
+ int tmp = inset->latex(buf, os, runparams,
style.free_spacing);
if (close)
///
void simpleTeXSpecialChars(Buffer const *, BufferParams const &,
std::ostream &, TexRow & texrow,
- LatexRunParams const &, bool moving_arg,
+ LatexRunParams const &,
LyXFont & font, LyXFont & running_font,
LyXFont & basefont,
LyXFont const & outerfont,
int LyXTabular::TeXLongtableHeaderFooter(ostream & os, Buffer const * buf,
LatexRunParams const & runparams,
- bool fragile, bool fp) const
+ bool fp) const
{
if (!is_long_tabular)
return 0;
}
for (int i = 0; i < rows_; ++i) {
if (row_info[i].endhead) {
- ret += TeXRow(os, i, buf, runparams, fragile, fp);
+ ret += TeXRow(os, i, buf, runparams, fp);
}
}
if (endhead.bottomDL) {
}
for (int i = 0; i < rows_; ++i) {
if (row_info[i].endfirsthead) {
- ret += TeXRow(os, i, buf, runparams, fragile, fp);
+ ret += TeXRow(os, i, buf, runparams, fp);
}
}
if (endfirsthead.bottomDL) {
}
for (int i = 0; i < rows_; ++i) {
if (row_info[i].endfoot) {
- ret += TeXRow(os, i, buf, runparams, fragile, fp);
+ ret += TeXRow(os, i, buf, runparams, fp);
}
}
if (endfoot.bottomDL) {
}
for (int i = 0; i < rows_; ++i) {
if (row_info[i].endlastfoot) {
- ret += TeXRow(os, i, buf, runparams, fragile, fp);
+ ret += TeXRow(os, i, buf, runparams, fp);
}
}
if (endlastfoot.bottomDL) {
int LyXTabular::TeXRow(ostream & os, int const i, Buffer const * buf,
- LatexRunParams const & runparams, bool fragile, bool fp) const
+ LatexRunParams const & runparams, bool fp) const
{
int ret = 0;
int cell = GetCellNumber(i, 0);
if (rtl)
os << "\\R{";
- ret += inset->latex(buf, os, runparams, fragile, fp);
+ ret += inset->latex(buf, os, runparams, fp);
if (rtl)
os << '}';
int LyXTabular::latex(Buffer const * buf, ostream & os,
- LatexRunParams const & runparams, bool fragile, bool fp) const
+ LatexRunParams const & runparams, bool fp) const
{
int ret = 0;
os << "}\n";
++ret;
- ret += TeXLongtableHeaderFooter(os, buf, runparams, fragile, fp);
+ ret += TeXLongtableHeaderFooter(os, buf, runparams, fp);
//+---------------------------------------------------------------------
//+ the single row and columns (cells) +
for (int i = 0; i < rows_; ++i) {
if (isValidRow(i)) {
- ret += TeXRow(os, i, buf, runparams, fragile, fp);
+ ret += TeXRow(os, i, buf, runparams, fp);
if (is_long_tabular && row_info[i].newpage) {
os << "\\newpage\n";
++ret;
///
void Read(Buffer const *, LyXLex &);
///
- int latex(Buffer const *, std::ostream &, LatexRunParams const &, bool, bool) const;
+ int latex(Buffer const *, std::ostream &, LatexRunParams const &,
+ bool) const;
///
int docbook(Buffer const * buf, std::ostream & os, bool mixcont) const;
///
int TeXCellPostamble(std::ostream &, int cell) const;
///
int TeXLongtableHeaderFooter(std::ostream &, Buffer const * buf,
- LatexRunParams const &, bool fragile, bool fp) const;
+ LatexRunParams const &, bool fp) const;
///
bool isValidRow(int const row) const;
///
int TeXRow(std::ostream &, int const row, Buffer const * buf,
- LatexRunParams const &, bool fragile, bool fp) const;
+ LatexRunParams const &, bool fp) const;
///
// helper function for ASCII returns number of newlines
///