Pass struct LatexRunParams around a bit...

git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@7008 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
Angus Leeming 2003-05-22 18:59:10 +00:00
parent bad6b92636
commit ccce6b9662
91 changed files with 312 additions and 167 deletions

View File

@ -1,3 +1,21 @@
2003-05-22 Angus Leeming <leeming@lyx.org>
* latexrunparams.h: new file containing struct LatexRunParams.
* Makefile.am: add new file.
* LaTeX.[Ch] (c-tor, run):
* buffer.[Ch] (makeLaTeXFile):
* bufferlist.[Ch] (updateIncludedTeXfiles):
* converter.C (convert, scanLog):
* converter.[Ch] (runLaTeX):
* exporter.C (Export):
* paragraph.[Ch] (simpleTeXOnePar):
* paragraph_funcs.C (TeXEnvironment, TeXOnePar, TeXDeeper):
* paragraph_funcs.[Ch] (latexParagraphs):
* paragraph_pimpl.[Ch] (simpleTeXSpecialChars):
* tabular.[Ch] (TeXLongtableHeaderFooter, TeXRow, latex):
pass around a LatexRunParams parameter.
2003-05-22 Lars Gullik Bjønnes <larsbj@gullik.net>
* paragraph.[Ch]: remove unused constructor
@ -39,7 +57,6 @@
* iterators.[Ch]: add two const's
2003-05-21 Lars Gullik Bjønnes <larsbj@gullik.net>
* toc.C (getTocList): adjust

View File

@ -107,8 +107,9 @@ bool operator!=(Aux_Info const & a, Aux_Info const & o)
* CLASS LaTeX
*/
LaTeX::LaTeX(string const & latex, string const & f, string const & p)
: cmd(latex), file(f), path(p)
LaTeX::LaTeX(string const & latex, LatexRunParams const & rp,
string const & f, string const & p)
: cmd(latex), file(f), path(p), runparams(rp)
{
num_errors = 0;
depfile = file + ".dep";
@ -163,7 +164,7 @@ int LaTeX::run(TeXErrors & terr, LyXFunc * lfun)
bool rerun = false; // rerun requested
// The class LaTeX does not know the temp path.
bufferlist.updateIncludedTeXfiles(lyx::getcwd());
bufferlist.updateIncludedTeXfiles(lyx::getcwd(), runparams);
// Never write the depfile if an error was encountered.

View File

@ -15,6 +15,7 @@
#ifndef LATEX_H
#define LATEX_H
#include "latexrunparams.h"
#include "LString.h"
#include "DepTable.h"
#include <vector>
@ -129,7 +130,8 @@ public:
cmd = the latex command, file = name of the (temporary) latex file,
path = name of the files original path.
*/
LaTeX(string const & cmd, string const & file, string const & path);
LaTeX(string const & cmd, LatexRunParams const &,
string const & file, string const & path);
/// runs LaTeX several times
int run(TeXErrors &, LyXFunc *);
@ -186,6 +188,9 @@ private:
/// The name of the final output file.
string output_file;
///
LatexRunParams runparams;
};
#endif

View File

@ -71,6 +71,7 @@ lyx_SOURCES = \
LaTeX.h \
LaTeXFeatures.C \
LaTeXFeatures.h \
latexrunparams.h \
Lsstream.h \
LyXAction.C \
LyXAction.h \

View File

@ -951,6 +951,7 @@ void Buffer::writeFileAscii(ostream & os, int linelen)
void Buffer::makeLaTeXFile(string const & fname,
string const & original_path,
LatexRunParams const & runparams,
bool nice, bool only_body, bool only_preamble)
{
lyxerr[Debug::LATEX] << "makeLaTeXFile..." << endl;
@ -964,7 +965,8 @@ void Buffer::makeLaTeXFile(string const & fname,
return;
}
makeLaTeXFile(ofs, original_path, nice, only_body, only_preamble);
makeLaTeXFile(ofs, original_path,
runparams, nice, only_body, only_preamble);
ofs.close();
if (ofs.fail()) {
@ -975,6 +977,7 @@ void Buffer::makeLaTeXFile(string const & fname,
void Buffer::makeLaTeXFile(ostream & os,
string const & original_path,
LatexRunParams const & runparams,
bool nice, bool only_body, bool only_preamble)
{
niceFile = nice; // this will be used by Insetincludes.
@ -1044,7 +1047,7 @@ void Buffer::makeLaTeXFile(ostream & os,
texrow.newline();
}
latexParagraphs(this, paragraphs, os, texrow, false);
latexParagraphs(this, paragraphs, os, texrow, runparams, false);
// add this just in case after all the paragraphs
os << endl;
@ -1958,7 +1961,9 @@ int Buffer::runChktex()
bool const removedErrorInsets = users->removeAutoInsets();
// Generate the LaTeX file if neccessary
makeLaTeXFile(name, org_path, false);
LatexRunParams runparams;
runparams.flavor = LatexRunParams::LATEX;
makeLaTeXFile(name, org_path, runparams, false);
TeXErrors terr;
Chktex chktex(lyxrc.chktex_command, name, filePath());

View File

@ -1,14 +1,13 @@
// -*- C++ -*-
/* This file is part of
* ======================================================
/**
* \file buffer.h
* This file is part of LyX, the document processor.
* Licence details can be found in the file COPYING.
*
* LyX, The Document Processor
* Copyright 1995 Matthias Ettrich
* \author Lars Gullik Bjønnes
*
* This file is Copyleft 1996
* Lars Gullik Bjønnes
*
* ====================================================== */
* Full author contact details are available in file CREDITS
*/
#ifndef BUFFER_H
#define BUFFER_H
@ -32,6 +31,7 @@ class BufferView;
class LyXRC;
class TeXErrors;
class LaTeXFeatures;
class LatexRunParams;
class Language;
class ParIterator;
class ParConstIterator;
@ -147,12 +147,14 @@ public:
/// Just a wrapper for the method below, first creating the ofstream.
void makeLaTeXFile(string const & filename,
string const & original_path,
LatexRunParams const &,
bool nice,
bool only_body = false,
bool only_preamble = false);
///
void makeLaTeXFile(std::ostream & os,
string const & original_path,
LatexRunParams const &,
bool nice,
bool only_body = false,
bool only_preamble = false);

View File

@ -224,7 +224,8 @@ Buffer * BufferList::getBuffer(unsigned int choice)
}
void BufferList::updateIncludedTeXfiles(string const & mastertmpdir)
void BufferList::updateIncludedTeXfiles(string const & mastertmpdir,
LatexRunParams const & runparams)
{
BufferStorage::iterator it = bstore.begin();
BufferStorage::iterator end = bstore.end();
@ -234,7 +235,7 @@ void BufferList::updateIncludedTeXfiles(string const & mastertmpdir)
writefile += '/';
writefile += (*it)->getLatexName();
(*it)->makeLaTeXFile(writefile, mastertmpdir,
false, true);
runparams, false, true);
(*it)->markDepClean(mastertmpdir);
}
}

View File

@ -19,6 +19,7 @@
#include <vector>
class Buffer;
class LatexRunParams;
/**
* The class holds all all open buffers, and handles construction
@ -60,7 +61,7 @@ public:
std::vector<string> const getFileNames() const;
/// FIXME
void updateIncludedTeXfiles(string const &);
void updateIncludedTeXfiles(string const &, LatexRunParams const &);
/// emergency save for all buffers
void emergencyWriteAll();

View File

@ -256,6 +256,9 @@ bool Converters::convert(Buffer const * buffer,
if (edgepath.empty()) {
return false;
}
LatexRunParams runparams;
runparams.flavor = usePdflatex(edgepath) ?
LatexRunParams::PDFLATEX : LatexRunParams::LATEX;
string path = OnlyPath(from_file);
Path p(path);
@ -292,7 +295,7 @@ bool Converters::convert(Buffer const * buffer,
run_latex = true;
string command = subst(conv.command, token_from, "");
lyxerr[Debug::FILES] << "Running " << command << endl;
if (!runLaTeX(buffer, command))
if (!runLaTeX(buffer, command, runparams))
return false;
} else {
if (conv.need_aux && !run_latex
@ -300,7 +303,7 @@ bool Converters::convert(Buffer const * buffer,
lyxerr[Debug::FILES]
<< "Running " << latex_command_
<< " to update aux file"<< endl;
runLaTeX(buffer, latex_command_);
runLaTeX(buffer, latex_command_, runparams);
}
string infile2 = (conv.original_dir)
@ -467,7 +470,9 @@ bool Converters::scanLog(Buffer const * buffer, string const & command,
return false;
BufferView * bv = buffer->getUser();
LaTeX latex("", filename, "");
LatexRunParams runparams;
runparams.flavor = LatexRunParams::LATEX;
LaTeX latex("", runparams, filename, "");
TeXErrors terr;
int result = latex.scanLogFile(terr);
@ -481,7 +486,8 @@ bool Converters::scanLog(Buffer const * buffer, string const & command,
}
bool Converters::runLaTeX(Buffer const * buffer, string const & command)
bool Converters::runLaTeX(Buffer const * buffer, string const & command,
LatexRunParams const & runparams)
{
if (!buffer)
return false;
@ -496,7 +502,7 @@ bool Converters::runLaTeX(Buffer const * buffer, string const & command)
// do the LaTeX run(s)
string name = buffer->getLatexName();
LaTeX latex(command, name, buffer->filePath());
LaTeX latex(command, runparams, name, buffer->filePath());
TeXErrors terr;
int result = latex.run(terr,
bv ? &bv->owner()->getLyXFunc() : 0);

View File

@ -13,6 +13,7 @@
* Full author contact details are available in file CREDITS
*/
#include "latexrunparams.h"
#include "graph.h"
#include <vector>
@ -133,7 +134,8 @@ private:
bool scanLog(Buffer const * buffer, string const & command,
string const & filename);
///
bool runLaTeX(Buffer const * buffer, string const & command);
bool runLaTeX(Buffer const * buffer, string const & command,
LatexRunParams const &);
///
ConverterList converterlist_;
///

View File

@ -26,8 +26,6 @@
using std::vector;
using std::find;
bool pdf_mode = false;
bool Exporter::Export(Buffer * buffer, string const & format,
bool put_in_tempdir, string & result_file)
{
@ -45,6 +43,8 @@ bool Exporter::Export(Buffer * buffer, string const & format,
}
string backend_format;
LatexRunParams runparams;
runparams.flavor = LatexRunParams::LATEX;
vector<string> backends = Backends(buffer);
if (find(backends.begin(), backends.end(), format) == backends.end()) {
for (vector<string>::const_iterator it = backends.begin();
@ -52,7 +52,8 @@ bool Exporter::Export(Buffer * buffer, string const & format,
Graph::EdgePath p =
converters.getPath(*it, format);
if (!p.empty()) {
pdf_mode = converters.usePdflatex(p);
if (converters.usePdflatex(p))
runparams.flavor = LatexRunParams::PDFLATEX;
backend_format = *it;
break;
}
@ -83,13 +84,14 @@ bool Exporter::Export(Buffer * buffer, string const & format,
buffer->makeDocBookFile(filename, !put_in_tempdir);
// LaTeX backend
else if (backend_format == format)
buffer->makeLaTeXFile(filename, string(), true);
buffer->makeLaTeXFile(filename, string(), runparams, true);
else if (contains(buffer->filePath(), ' ')) {
Alert::error(_("File name error"),
_("The directory path to the document cannot contain spaces."));
return false;
} else
buffer->makeLaTeXFile(filename, buffer->filePath(), false);
buffer->makeLaTeXFile(filename, buffer->filePath(),
runparams, false);
string outfile_base = (put_in_tempdir)
? filename : buffer->getLatexName(false);

View File

@ -1,3 +1,7 @@
2003-05-22 Angus Leeming <leeming@lyx.org>
* PreviewLoader.C (dumpPreamble):
pass around a LatexRunParams parameter.
2003-05-13 André Pönitz <poenitz@gmx.net>

View File

@ -564,7 +564,9 @@ void PreviewLoader::Impl::dumpPreamble(ostream & os) const
// Why on earth is Buffer::makeLaTeXFile a non-const method?
Buffer & tmp = const_cast<Buffer &>(buffer_);
// Dump the preamble only.
tmp.makeLaTeXFile(os, buffer_.filePath(), true, false, true);
LatexRunParams runparams;
runparams.flavor = LatexRunParams::LATEX;
tmp.makeLaTeXFile(os, buffer_.filePath(), runparams, true, false, true);
// FIXME! This is a HACK! The proper fix is to control the 'true'
// passed to WriteStream below:
@ -585,7 +587,7 @@ void PreviewLoader::Impl::dumpPreamble(ostream & os) const
for (; it != end; ++it)
if (it->lyxCode() == Inset::MATHMACRO_CODE)
it->latex(&buffer_, os, true, true);
it->latex(&buffer_, os, runparams, true, true);
// All equation lables appear as "(#)" + preview.sty's rendering of
// the label name

View File

@ -1,3 +1,10 @@
2003-05-22 Angus Leeming <leeming@lyx.org>
* inset*.[Ch] (latex):
passed a LatexRunParams parameter.
* insetgraphics.C (latex): actually use it ;-)
2003-05-22 Alfredo Braunstein <abraunst@libero.it>
* insetfloat.C (addToToc): trivial compile fix

View File

@ -26,6 +26,7 @@ class LyXFont;
class Dimension;
class Buffer;
class Painter;
class LatexRunParams;
class LyXText;
class LyXLex;
class Paragraph;
@ -193,7 +194,9 @@ public:
If the free_spc (freespacing) variable is set, then this inset
is in a free-spacing paragraph.
*/
virtual int latex(Buffer const *, std::ostream &, bool fragile,
virtual int latex(Buffer const *, std::ostream &,
LatexRunParams const &,
bool fragile,
bool free_spc) const = 0;
///
virtual int ascii(Buffer const *,

View File

@ -82,7 +82,7 @@ string const InsetBibtex::getScreenLabel(Buffer const *) const
}
int InsetBibtex::latex(Buffer const * buffer, ostream & os,
int InsetBibtex::latex(Buffer const * buffer, ostream & os, LatexRunParams const &,
bool /*fragile*/, bool/*fs*/) const
{
// changing the sequence of the commands

View File

@ -39,7 +39,7 @@ public:
///
Inset::Code lyxCode() const { return Inset::BIBTEX_CODE; }
///
int latex(Buffer const *, std::ostream &,
int latex(Buffer const *, std::ostream &, LatexRunParams const &,
bool fragile, bool freespace) const;
///
void fillWithBibKeys(Buffer const *,

View File

@ -105,7 +105,7 @@ void InsetCaption::draw(BufferView * bv, LyXFont const & f,
}
int InsetCaption::latex(Buffer const * buf, ostream & os,
int InsetCaption::latex(Buffer const * buf, ostream & os, LatexRunParams const & runparams,
bool fragile, bool free_spc) const
{
// This is a bit too simplistic to take advantage of
@ -114,7 +114,7 @@ int InsetCaption::latex(Buffer const * buf, ostream & os,
// \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, fragile, free_spc);
int const l = InsetText::latex(buf, ost, runparams, fragile, free_spc);
os << "\\caption{" << ost.str() << "}\n";
return l + 1;
}

View File

@ -37,7 +37,7 @@ public:
virtual void draw(BufferView * bv, LyXFont const & f,
int baseline, float & x) const;
///
virtual int latex(Buffer const * buf, std::ostream & os,
virtual int latex(Buffer const * buf, std::ostream & os, LatexRunParams const &,
bool fragile, bool free_spc) const;
///
int ascii(Buffer const * buf, std::ostream & os, int linelen) const;

View File

@ -353,7 +353,7 @@ int InsetCitation::ascii(Buffer const * buffer, ostream & os, int) 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,
int InsetCitation::latex(Buffer const * buffer, ostream & os, LatexRunParams const &,
bool /*fragile*/, bool/*fs*/) const
{
os << "\\";

View File

@ -37,7 +37,7 @@ public:
///
int ascii(Buffer const *, std::ostream &, int linelen) const;
///
int latex(Buffer const *, std::ostream &, bool, bool) const;
int latex(Buffer const *, std::ostream &, LatexRunParams const &, bool, bool) const;
///
dispatch_result localDispatch(FuncRequest const & cmd);
///

View File

@ -272,9 +272,10 @@ void InsetCollapsable::lfunMouseRelease(FuncRequest const & cmd)
int InsetCollapsable::latex(Buffer const * buf, ostream & os,
LatexRunParams const & runparams,
bool fragile, bool free_spc) const
{
return inset.latex(buf, os, fragile, free_spc);
return inset.latex(buf, os, runparams, fragile, free_spc);
}

View File

@ -79,7 +79,7 @@ public:
///
RESULT localDispatch(FuncRequest const &);
///
int latex(Buffer const *, std::ostream &,
int latex(Buffer const *, std::ostream &, LatexRunParams const &,
bool fragile, bool free_spc) const;
///
int ascii(Buffer const *, std::ostream &, int) const;

View File

@ -39,7 +39,7 @@ void InsetCommand::setParams(InsetCommandParams const & p)
}
int InsetCommand::latex(Buffer const *, ostream & os,
int InsetCommand::latex(Buffer const *, ostream & os, LatexRunParams const &,
bool /*fragile*/, bool/*fs*/) const
{
os << getCommand();

View File

@ -41,7 +41,7 @@ public:
/// Can remove one InsetBibKey is modified
void scanCommand(string const & c) { p_.scanCommand(c); };
///
virtual int latex(Buffer const *, std::ostream &,
virtual int latex(Buffer const *, std::ostream &, LatexRunParams const &,
bool fragile, bool free_spc) const;
///
int ascii(Buffer const *, std::ostream &, int linelen) const;

View File

@ -65,12 +65,13 @@ string const InsetEnvironment::editMessage() const
}
int InsetEnvironment::latex(Buffer const * buf,
ostream & os, bool fragile, bool) const
int InsetEnvironment::latex(Buffer const * buf, ostream & os,
LatexRunParams const & runparams,
bool fragile, bool) const
{
os << layout_->latexheader;
TexRow texrow;
latexParagraphs(buf, paragraphs, os, texrow, fragile,
latexParagraphs(buf, paragraphs, os, texrow, runparams, fragile,
layout_->latexparagraph);
os << layout_->latexfooter;
return texrow.rows();

View File

@ -30,7 +30,8 @@ public:
///
Inset::Code lyxCode() const { return Inset::ENVIRONMENT_CODE; }
///
int latex(Buffer const *, std::ostream &, bool fragile, bool fp) const;
int latex(Buffer const *, std::ostream &, LatexRunParams const &,
bool fragile, bool fp) const;
///
string const editMessage() const;
///

View File

@ -38,7 +38,8 @@ public:
///
void read(Buffer const *, LyXLex &) {}
///
int latex(Buffer const *, std::ostream &, bool, bool) const { return 0; }
int latex(Buffer const *, std::ostream &, LatexRunParams const &,
bool, bool) const { return 0; }
///
int ascii(Buffer const *, std::ostream &, int) const { return 0; }
///

View File

@ -323,8 +323,8 @@ void InsetERT::lfunMouseMotion(FuncRequest const & cmd)
}
int InsetERT::latex(Buffer const *, ostream & os, bool /*fragile*/,
bool /*free_spc*/) const
int InsetERT::latex(Buffer const *, ostream & os, LatexRunParams const &,
bool /*fragile*/, bool /*free_spc*/) const
{
ParagraphList::iterator par = inset.paragraphs.begin();
ParagraphList::iterator end = inset.paragraphs.end();

View File

@ -64,7 +64,7 @@ public:
///
EDITABLE editable() const;
///
int latex(Buffer const *, std::ostream &, bool fragile,
int latex(Buffer const *, std::ostream &, LatexRunParams const &, bool fragile,
bool free_spc) const;
///
int ascii(Buffer const *,

View File

@ -166,8 +166,8 @@ int InsetExternal::write(string const & format,
}
int InsetExternal::latex(Buffer const * buf,
ostream & os, bool, bool) const
int InsetExternal::latex(Buffer const * buf, ostream & os, LatexRunParams const &,
bool, bool) const
{
return write("LaTeX", buf, os);
}

View File

@ -53,8 +53,8 @@ public:
If the free_spc (freespacing) variable is set, then this inset
is in a free-spacing paragraph.
*/
virtual int latex(Buffer const *, std::ostream &, bool fragile,
bool free_spc) const;
virtual int latex(Buffer const *, std::ostream &, LatexRunParams const &,
bool fragile, 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

View File

@ -271,8 +271,8 @@ string const InsetFloat::editMessage() const
}
int InsetFloat::latex(Buffer const * buf,
ostream & os, bool fragile, bool fp) const
int InsetFloat::latex(Buffer const * buf, ostream & os, LatexRunParams const & runparams,
bool fragile, bool fp) const
{
FloatList const & floats = buf->params.getLyXTextClass().floats();
string const tmptype = (params_.wide ? params_.type + "*" : params_.type);
@ -303,7 +303,7 @@ int InsetFloat::latex(Buffer const * buf,
}
os << '\n';
int const i = inset.latex(buf, os, fragile, fp);
int const i = inset.latex(buf, os, runparams, fragile, 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.

View File

@ -57,7 +57,8 @@ public:
///
Inset::Code lyxCode() const { return Inset::FLOAT_CODE; }
///
int latex(Buffer const *, std::ostream &, bool fragile, bool fp) const;
int latex(Buffer const *, std::ostream &, LatexRunParams const &,
bool fragile, bool fp) const;
///
int docbook(Buffer const *, std::ostream &, bool mixcont) const;
///

View File

@ -107,7 +107,8 @@ dispatch_result InsetFloatList::localDispatch(FuncRequest const & cmd)
}
int InsetFloatList::latex(Buffer const * buf, ostream & os, bool, bool) const
int InsetFloatList::latex(Buffer const * buf, ostream & os, LatexRunParams const &,
bool, bool) const
{
FloatList const & floats = buf->params.getLyXTextClass().floats();
FloatList::const_iterator cit = floats[getCmdName()];

View File

@ -44,7 +44,8 @@ public:
///
void read(Buffer const *, LyXLex &);
///
int latex(Buffer const *, std::ostream &, bool, bool) const;
int latex(Buffer const *, std::ostream &, LatexRunParams const &,
bool, bool) const;
///
int linuxdoc(Buffer const *, std::ostream &) const { return 0; }
///

View File

@ -57,8 +57,8 @@ string const InsetFoot::editMessage() const
}
int InsetFoot::latex(Buffer const * buf,
ostream & os, bool fragile, bool fp) const
int InsetFoot::latex(Buffer const * buf, ostream & os, LatexRunParams const & runparams,
bool fragile, bool fp) const
{
if (buf && parOwner()) {
LyXLayout_ptr const & layout = parOwner()->layout();
@ -67,7 +67,7 @@ int InsetFoot::latex(Buffer const * buf,
os << "%\n\\footnote{";
int const i = inset.latex(buf, os, fragile, fp);
int const i = inset.latex(buf, os, runparams, fragile, fp);
os << "%\n}";
return i + 2;

View File

@ -31,7 +31,8 @@ public:
///
Inset::Code lyxCode() const { return Inset::FOOT_CODE; }
///
int latex(Buffer const *, std::ostream &, bool fragile, bool fp) const;
int latex(Buffer const *, std::ostream &, LatexRunParams const &,
bool fragile, bool fp) const;
///
int docbook(Buffer const *, std::ostream &, bool mixcont) const;
///

View File

@ -69,6 +69,7 @@ TODO
#include "funcrequest.h"
#include "gettext.h"
#include "LaTeXFeatures.h"
#include "latexrunparams.h"
#include "Lsstream.h"
#include "lyxlex.h"
#include "lyxrc.h"
@ -99,7 +100,6 @@ TODO
extern string system_tempdir;
// set by Exporters
extern bool pdf_mode;
using std::ostream;
using std::endl;
@ -127,12 +127,10 @@ string const uniqueID()
}
string findTargetFormat(string const & suffix)
string findTargetFormat(string const & suffix, LatexRunParams const & runparams)
{
// pdf_mode means:
// Are we creating a PDF or a PS file?
// (Should actually mean, are we using latex or pdflatex).
if (pdf_mode) {
// Are we using latex or pdflatex).
if (runparams.flavor == LatexRunParams::PDFLATEX) {
lyxerr[Debug::GRAPHICS] << "findTargetFormat: PDF mode\n";
if (contains(suffix, "ps") || suffix == "pdf")
return "pdf";
@ -516,7 +514,8 @@ string const InsetGraphics::createLatexOptions() const
}
string const InsetGraphics::prepareFile(Buffer const * buf) const
string const InsetGraphics::prepareFile(Buffer const * buf,
LatexRunParams const & runparams) const
{
// LaTeX can cope if the graphics file doesn't exist, so just return the
// filename.
@ -577,7 +576,7 @@ string const InsetGraphics::prepareFile(Buffer const * buf) const
}
string const from = getExtFromContents(orig_file_with_path);
string const to = findTargetFormat(from);
string const to = findTargetFormat(from, runparams);
lyxerr[Debug::GRAPHICS]
<< "\t we have: from " << from << " to " << to << '\n';
@ -673,7 +672,7 @@ string const InsetGraphics::prepareFile(Buffer const * buf) const
}
int InsetGraphics::latex(Buffer const * buf, ostream & os,
int InsetGraphics::latex(Buffer const * buf, ostream & os, LatexRunParams const & runparams,
bool /*fragile*/, bool/*fs*/) const
{
// If there is no file specified or not existing,
@ -736,7 +735,7 @@ int InsetGraphics::latex(Buffer const * buf, ostream & os,
// and remove the extension so the LaTeX will use whatever is
// appropriate (when there are several versions in different formats)
string const latex_str = message.empty() ?
(before + '{' + os::external_path(prepareFile(buf)) + '}' + after) :
(before + '{' + os::external_path(prepareFile(buf, runparams)) + '}' + after) :
(before + '{' + params().filename + " not found!}" + after);
os << latex_str;

View File

@ -49,7 +49,7 @@ public:
#fragile == true# means, that the inset should take care about
fragile commands by adding a #\protect# before.
*/
int latex(Buffer const *, std::ostream &,
int latex(Buffer const *, std::ostream &, LatexRunParams const &,
bool fragile, bool free_spc) const;
///
int ascii(Buffer const *, std::ostream &, int linelen) const;
@ -101,7 +101,7 @@ private:
/// Create the options for the latex command.
string const createLatexOptions() const;
/// Convert the file if needed, and return the location of the file.
string const prepareFile(Buffer const * buf) const;
string const prepareFile(Buffer const * buf, LatexRunParams const &) const;
///
InsetGraphicsParams params_;

View File

@ -21,7 +21,7 @@ InsetHFill::InsetHFill()
{}
int InsetHFill::latex(Buffer const *, ostream & os,
int InsetHFill::latex(Buffer const *, ostream & os, LatexRunParams const &,
bool /*fragile*/, bool /*fs*/) const
{
os << getCommand();

View File

@ -28,7 +28,8 @@ public:
///
Inset::Code lyxCode() const { return Inset::HFILL_CODE; }
///
int latex(Buffer const *, std::ostream &, bool fragile, bool free_spc) const;
int latex(Buffer const *, std::ostream &, LatexRunParams const &,
bool fragile, bool free_spc) const;
///
int ascii(Buffer const *, std::ostream &, int linelen) const;
///

View File

@ -18,6 +18,7 @@
#include "funcrequest.h"
#include "gettext.h"
#include "LaTeXFeatures.h"
#include "latexrunparams.h"
#include "Lsstream.h"
#include "lyxlex.h"
#include "lyxrc.h"
@ -285,6 +286,7 @@ bool InsetInclude::loadIfNeeded() const
int InsetInclude::latex(Buffer const * buffer, ostream & os,
LatexRunParams const & runparams,
bool /*fragile*/, bool /*fs*/) const
{
string incfile(params_.cparams.getContents());
@ -328,6 +330,7 @@ int InsetInclude::latex(Buffer const * buffer, ostream & os,
tmp->makeLaTeXFile(writefile,
OnlyPath(getMasterFilename()),
runparams,
buffer->niceFile, true);
}
@ -573,7 +576,9 @@ string const InsetInclude::PreviewImpl::latexString() const
return string();
ostringstream os;
parent().latex(view()->buffer(), os, false, false);
LatexRunParams runparams;
runparams.flavor = LatexRunParams::LATEX;
parent().latex(view()->buffer(), os, runparams, false, false);
return STRCONV(os.str());
}

View File

@ -91,7 +91,7 @@ public:
///
void read(Buffer const *, LyXLex &);
///
int latex(Buffer const *, std::ostream &,
int latex(Buffer const *, std::ostream &, LatexRunParams const &,
bool fragile, bool free_spc) const;
///
int ascii(Buffer const *, std::ostream &, int linelen) const;

View File

@ -82,7 +82,7 @@ dispatch_result InsetLabel::localDispatch(FuncRequest const & cmd)
}
int InsetLabel::latex(Buffer const *, ostream & os,
int InsetLabel::latex(Buffer const *, ostream & os, LatexRunParams const &,
bool /*fragile*/, bool /*fs*/) const
{
os << escape(getCommand());

View File

@ -36,7 +36,7 @@ public:
///
std::vector<string> const getLabelList() const;
///
int latex(Buffer const *, std::ostream &,
int latex(Buffer const *, std::ostream &, LatexRunParams const &,
bool fragile, bool free_spc) const;
///
int ascii(Buffer const *, std::ostream &, int linelen) const;

View File

@ -621,7 +621,7 @@ void InsetLatexAccent::read(Buffer const *, LyXLex & lex)
}
int InsetLatexAccent::latex(Buffer const *, ostream & os,
int InsetLatexAccent::latex(Buffer const *, ostream & os, LatexRunParams const &,
bool /*fragile*/, bool/*fs*/) const
{
os << contents;

View File

@ -49,7 +49,7 @@ public:
///
void read(Buffer const *, LyXLex & lex);
///
int latex(Buffer const *, std::ostream &,
int latex(Buffer const *, std::ostream &, LatexRunParams const &,
bool fragile, bool free_spc) const;
///
int ascii(Buffer const *, std::ostream &, int linelen) const;

View File

@ -27,7 +27,8 @@ public:
///
Inset::Code lyxCode() const { return Inset::FOOT_CODE; }
///
int latex(Buffer const *, std::ostream &, bool fragile, bool fp) const;
int latex(Buffer const *, std::ostream &, LatexRunParams const &,
bool fragile, bool fp) const;
///
string const editMessage() const;
};

View File

@ -53,12 +53,12 @@ string const InsetMarginal::editMessage() const
}
int InsetMarginal::latex(Buffer const * buf,
ostream & os, bool fragile, bool fp) const
int InsetMarginal::latex(Buffer const * buf, ostream & os, LatexRunParams const & runparams,
bool fragile, bool fp) const
{
os << "%\n\\marginpar{";
int const i = inset.latex(buf, os, fragile, fp);
int const i = inset.latex(buf, os, runparams, fragile, fp);
os << "%\n}";
return i + 2;

View File

@ -30,7 +30,8 @@ public:
///
Inset::Code lyxCode() const { return Inset::MARGIN_CODE; }
///
int latex(Buffer const *, std::ostream &, bool fragile, bool fp) const;
int latex(Buffer const *, std::ostream &, LatexRunParams const &,
bool fragile, bool fp) const;
///
string const editMessage() const;
};

View File

@ -250,8 +250,8 @@ string const InsetMinipage::editMessage() const
}
int InsetMinipage::latex(Buffer const * buf,
ostream & os, bool fragile, bool fp) const
int InsetMinipage::latex(Buffer const * buf, ostream & os, LatexRunParams const & runparams,
bool fragile, bool fp) const
{
string s_pos;
switch (params_.pos) {
@ -268,7 +268,7 @@ int InsetMinipage::latex(Buffer const * buf,
os << "\\begin{minipage}[" << s_pos << "]{"
<< params_.width.asLatexString() << "}%\n";
int i = inset.latex(buf, os, fragile, fp);
int i = inset.latex(buf, os, runparams, fragile, fp);
os << "\\end{minipage}%\n";
return i + 2;

View File

@ -72,7 +72,8 @@ public:
///
Inset::Code lyxCode() const { return Inset::MINIPAGE_CODE; }
///
int latex(Buffer const *, std::ostream &, bool fragile, bool fp) const;
int latex(Buffer const *, std::ostream &, LatexRunParams const &,
bool fragile, bool fp) const;
///
string const editMessage() const;
///

View File

@ -46,7 +46,8 @@ void InsetNewline::dimension(BufferView *, LyXFont const & font,
}
int InsetNewline::latex(Buffer const *, ostream &, bool, bool) const
int InsetNewline::latex(Buffer const *, ostream &, LatexRunParams const &,
bool, bool) const
{
lyxerr << "Eek, calling InsetNewline::latex !" << endl;
return 0;

View File

@ -31,7 +31,8 @@ public:
virtual void draw(BufferView *, LyXFont const &,
int baseline, float & x) const;
virtual int latex(Buffer const *, std::ostream &, bool fragile, bool free_spc) const;
virtual int latex(Buffer const *, std::ostream &, LatexRunParams const &,
bool fragile, bool free_spc) const;
virtual int ascii(Buffer const *, std::ostream &, int linelen) const;

View File

@ -33,7 +33,8 @@ public:
///
void write(Buffer const *, std::ostream &) const;
///
int latex(Buffer const *, std::ostream &, bool, bool) const
int latex(Buffer const *, std::ostream &, LatexRunParams const &,
bool, bool) const
{ return 0; }
///
int linuxdoc(Buffer const *, std::ostream &) const

View File

@ -66,17 +66,18 @@ void InsetOptArg::write(Buffer const * buf, ostream & os) const
}
int InsetOptArg::latex(Buffer const *, ostream &, bool, bool) const
int InsetOptArg::latex(Buffer const *, ostream &, LatexRunParams const &,
bool, bool) const
{
return 0;
}
int InsetOptArg::latexOptional(Buffer const * buf, ostream & os,
bool, bool fp) const
LatexRunParams const & runparams, bool, bool fp) const
{
os << '[';
int const i = inset.latex(buf, os, false, fp);
int const i = inset.latex(buf, os, runparams, false, fp);
os << ']';
return i + 2;
}

View File

@ -38,11 +38,11 @@ public:
string const editMessage() const;
/// Standard LaTeX output -- short-circuited
int latex(Buffer const *, std::ostream &,
bool fragile, bool fp) const;
int latex(Buffer const *, std::ostream &, LatexRunParams const &,
bool fragile, bool fp) const;
/// Outputting the optional parameter of a LaTeX command
int latexOptional(Buffer const *, std::ostream &,
bool fragile, bool fp) const;
int latexOptional(Buffer const *, std::ostream &, LatexRunParams const &,
bool fragile, bool fp) const;
/// Write out tothe .lyx file
void write(Buffer const * buf, std::ostream & os) const;
};

View File

@ -54,10 +54,10 @@ dispatch_result InsetParent::localDispatch(FuncRequest const & cmd)
// LaTeX must just ignore this command
int InsetParent::latex(Buffer const * buf, ostream & os,
int InsetParent::latex(Buffer const * buf, ostream & os, LatexRunParams const & runparams,
bool fragile, bool free_spc) const
{
os << "%%#{lyx}";
InsetCommand::latex(buf, os, fragile, free_spc);
InsetCommand::latex(buf, os, runparams, fragile, free_spc);
return 0;
}

View File

@ -39,7 +39,7 @@ public:
///
Inset::Code lyxCode() const { return Inset::PARENT_CODE; }
///
int latex(Buffer const *, std::ostream &,
int latex(Buffer const *, std::ostream &, LatexRunParams const &,
bool fragile, bool free_spc) const;
///
void setParent(string const & fn) { setContents(fn); }

View File

@ -239,7 +239,7 @@ void InsetQuotes::read(Buffer const *, LyXLex & lex)
extern bool use_babel;
int InsetQuotes::latex(Buffer const * buf, ostream & os,
int InsetQuotes::latex(Buffer const * buf, ostream & os, LatexRunParams const &,
bool /*fragile*/, bool /* free_spc */) const
{
// How do we get the local language here??

View File

@ -83,7 +83,7 @@ public:
///
void read(Buffer const *, LyXLex & lex);
///
int latex(Buffer const *, std::ostream &,
int latex(Buffer const *, std::ostream &, LatexRunParams const &,
bool fragile, bool free_spc) const;
///
int ascii(Buffer const *, std::ostream &, int linelen) const;

View File

@ -71,7 +71,7 @@ string const InsetRef::getScreenLabel(Buffer const *) const
}
int InsetRef::latex(Buffer const *, ostream & os,
int InsetRef::latex(Buffer const *, ostream & os, LatexRunParams const &,
bool /*fragile*/, bool /*fs*/) const
{
if (getOptions().empty())

View File

@ -54,7 +54,7 @@ public:
///
bool display() const { return false; }
///
int latex(Buffer const *, std::ostream &,
int latex(Buffer const *, std::ostream &, LatexRunParams const &,
bool fragile, bool free_spc) const;
///
int ascii(Buffer const *, std::ostream &, int linelen) const;

View File

@ -156,8 +156,8 @@ void InsetSpace::read(Buffer const *, LyXLex & lex)
}
int InsetSpace::latex(Buffer const *, ostream & os, bool /*fragile*/,
bool free_space) const
int InsetSpace::latex(Buffer const *, ostream & os, LatexRunParams const &,
bool /*fragile*/, bool free_space) const
{
switch (kind_) {
case NORMAL:

View File

@ -61,7 +61,7 @@ public:
/// Will not be used when lyxf3
void read(Buffer const *, LyXLex & lex);
///
int latex(Buffer const *, std::ostream &,
int latex(Buffer const *, std::ostream &, LatexRunParams const &,
bool fragile, bool free_spc) const;
///
int ascii(Buffer const *, std::ostream &, int linelen) const;

View File

@ -160,8 +160,8 @@ void InsetSpecialChar::read(Buffer const *, LyXLex & lex)
}
int InsetSpecialChar::latex(Buffer const *, ostream & os, bool /*fragile*/,
bool free_space) const
int InsetSpecialChar::latex(Buffer const *, ostream & os, LatexRunParams const &,
bool /*fragile*/, bool free_space) const
{
switch (kind_) {
case HYPHENATION:

View File

@ -54,7 +54,7 @@ public:
/// Will not be used when lyxf3
void read(Buffer const *, LyXLex & lex);
///
int latex(Buffer const *, std::ostream &,
int latex(Buffer const *, std::ostream &, LatexRunParams const &,
bool fragile, bool free_spc) const;
///
int ascii(Buffer const *, std::ostream &, int linelen) const;

View File

@ -1192,10 +1192,10 @@ Inset::RESULT InsetTabular::localDispatch(FuncRequest const & cmd)
}
int InsetTabular::latex(Buffer const * buf, ostream & os,
int InsetTabular::latex(Buffer const * buf, ostream & os, LatexRunParams const & runparams,
bool fragile, bool fp) const
{
return tabular->latex(buf, os, fragile, fp);
return tabular->latex(buf, os, runparams, fragile, fp);
}

View File

@ -125,7 +125,8 @@ public:
///
RESULT localDispatch(FuncRequest const &);
///
int latex(Buffer const *, std::ostream &, bool, bool) const;
int latex(Buffer const *, std::ostream &, LatexRunParams const &,
bool, bool) const;
///
int ascii(Buffer const *, std::ostream &, int linelen) const;
///

View File

@ -1447,10 +1447,11 @@ Inset::RESULT InsetText::localDispatch(FuncRequest const & cmd)
}
int InsetText::latex(Buffer const * buf, ostream & os, bool fragile, bool) const
int InsetText::latex(Buffer const * buf, ostream & os, LatexRunParams const & runparams,
bool fragile, bool) const
{
TexRow texrow;
latexParagraphs(buf, paragraphs, os, texrow, fragile);
latexParagraphs(buf, paragraphs, os, texrow, runparams, fragile);
return texrow.rows();
}

View File

@ -112,7 +112,7 @@ public:
///
RESULT localDispatch(FuncRequest const &);
///
int latex(Buffer const *, std::ostream &,
int latex(Buffer const *, std::ostream &, LatexRunParams const &,
bool fragile, bool free_spc) const;
///
int ascii(Buffer const *, std::ostream &, int linelen) const;

View File

@ -31,7 +31,8 @@ public:
///
bool display() const { return true; }
///
int latex(Buffer const *, std::ostream &, bool fragile, bool fp) const;
int latex(Buffer const *, std::ostream &, LatexRunParams const &,
bool fragile, bool fp) const;
///
string const editMessage() const;
};

View File

@ -70,7 +70,7 @@ string const InsetUrl::getScreenLabel(Buffer const *) const
}
int InsetUrl::latex(Buffer const *, ostream & os,
int InsetUrl::latex(Buffer const *, ostream & os, LatexRunParams const &,
bool fragile, bool /*free_spc*/) const
{
if (!getOptions().empty())

View File

@ -43,7 +43,7 @@ public:
///
bool display() const { return false; }
///
int latex(Buffer const *, std::ostream &,
int latex(Buffer const *, std::ostream &, LatexRunParams const &,
bool fragile, bool free_spc) const;
///
int ascii(Buffer const *, std::ostream &, int linelen) const;

View File

@ -192,8 +192,8 @@ string const InsetWrap::editMessage() const
}
int InsetWrap::latex(Buffer const * buf,
ostream & os, bool fragile, bool fp) const
int InsetWrap::latex(Buffer const * buf, ostream & os, LatexRunParams const & runparams,
bool fragile, bool fp) const
{
os << "\\begin{floating" << params_.type << '}';
if (!params_.placement.empty()) {
@ -201,7 +201,7 @@ int InsetWrap::latex(Buffer const * buf,
}
os << '{' << params_.width.asLatexString() << "}%\n";
int const i = inset.latex(buf, os, fragile, fp);
int const i = inset.latex(buf, os, runparams, fragile, fp);
os << "\\end{floating" << params_.type << "}%\n";
return i + 2;

View File

@ -55,7 +55,8 @@ public:
///
Inset::Code lyxCode() const { return Inset::WRAP_CODE; }
///
int latex(Buffer const *, std::ostream &, bool fragile, bool fp) const;
int latex(Buffer const *, std::ostream &, LatexRunParams const &,
bool fragile, bool fp) const;
///
int docbook(Buffer const *, std::ostream &, bool mixcont) const;
///

37
src/latexrunparams.h Normal file
View File

@ -0,0 +1,37 @@
// -*- C++ -*-
/**
* \file latexrunparams.h
* This file is part of LyX, the document processor.
* Licence details can be found in the file COPYING.
*
* \author Angus Leeming
*
* Full author contact details are available in file CREDITS
*/
#ifndef LatexRunParams_H
#define LatexRunParams_H
/** The latex that we export depends occasionally on what is to
compile the file.
*/
struct LatexRunParams {
enum FLAVOR {
LATEX,
PDFLATEX
};
LatexRunParams() : flavor(LATEX) {}
//, nice(false), fragile(false) {}
FLAVOR flavor;
// bool nice;
// bool fragile;
};
// enum LatexFlavor {
// LATEX_FLAVOR,
// PDFLATEX_FLAVOR
// };
#endif // LatexRunParams_H

View File

@ -1,3 +1,8 @@
2003-05-22 Angus Leeming <leeming@lyx.org>
* formula.[Ch] (latex):
* formulamacro.[Ch] (latex):
passed a LatexRunParams parameter.
2003-05-19 André Pönitz <poenitz@gmx.net>

View File

@ -127,7 +127,8 @@ void InsetFormula::write(Buffer const *, ostream & os) const
}
int InsetFormula::latex(Buffer const *, ostream & os, bool fragile, bool) const
int InsetFormula::latex(Buffer const *, ostream & os, LatexRunParams const &,
bool fragile, bool) const
{
WriteStream wi(os, fragile, true);
par_->write(wi);

View File

@ -44,7 +44,8 @@ public:
///
void read(Buffer const *, LyXLex & lex);
///
int latex(Buffer const *, std::ostream &, bool fragile, bool free_spc) const;
int latex(Buffer const *, std::ostream &, LatexRunParams const &,
bool fragile, bool free_spc) const;
///
int ascii(Buffer const *, std::ostream &, int linelen) const;
///

View File

@ -79,8 +79,8 @@ void InsetFormulaMacro::write(Buffer const *, ostream & os) const
}
int InsetFormulaMacro::latex(Buffer const *, ostream & os, bool fragile,
bool /*free_spacing*/) const
int InsetFormulaMacro::latex(Buffer const *, ostream & os, LatexRunParams const &,
bool fragile, bool /*free_spacing*/) const
{
WriteStream wi(os, fragile, true);
par()->write(wi);

View File

@ -44,7 +44,8 @@ public:
///
int ascii(Buffer const *, std::ostream &, int linelen) const;
///
int latex(Buffer const *, std::ostream & os, bool fragile, bool free_spc) const;
int latex(Buffer const *, std::ostream & os, LatexRunParams const &,
bool fragile, bool free_spc) const;
///
int linuxdoc(Buffer const *, std::ostream & os) const;
///

View File

@ -906,6 +906,7 @@ bool Paragraph::simpleTeXOnePar(Buffer const * buf,
BufferParams const & bparams,
LyXFont const & outerfont,
ostream & os, TexRow & texrow,
LatexRunParams const & runparams,
bool moving_arg)
{
lyxerr[Debug::LATEX] << "SimpleTeXOnePar... " << this << endl;
@ -1052,7 +1053,7 @@ bool Paragraph::simpleTeXOnePar(Buffer const * buf,
running_change = change;
pimpl_->simpleTeXSpecialChars(buf, bparams,
os, texrow, moving_arg,
os, texrow, runparams, moving_arg,
font, running_font,
basefont, outerfont, open_font,
running_change,

View File

@ -27,6 +27,7 @@ class Counters;
class InsetBibitem;
class Language;
class LaTeXFeatures;
class LatexRunParams;
class ParagraphParameters;
class TexRow;
@ -99,7 +100,8 @@ public:
///
bool simpleTeXOnePar(Buffer const *, BufferParams const &,
LyXFont const & outerfont, std::ostream &,
TexRow & texrow, bool moving_arg);
TexRow & texrow, LatexRunParams const &,
bool moving_arg);
///
bool hasSameLayout(Paragraph const & par) const;

View File

@ -274,13 +274,15 @@ ParagraphList::iterator
TeXEnvironment(Buffer const * buf,
ParagraphList const & paragraphs,
ParagraphList::iterator pit,
ostream & os, TexRow & texrow);
ostream & os, TexRow & texrow,
LatexRunParams const & runparams);
ParagraphList::iterator
TeXOnePar(Buffer const * buf,
ParagraphList const & paragraphs,
ParagraphList::iterator pit,
ostream & os, TexRow & texrow,
LatexRunParams const & runparams,
bool moving_arg,
string const & everypar = string());
@ -289,7 +291,8 @@ ParagraphList::iterator
TeXDeeper(Buffer const * buf,
ParagraphList const & paragraphs,
ParagraphList::iterator pit,
ostream & os, TexRow & texrow)
ostream & os, TexRow & texrow,
LatexRunParams const & runparams)
{
lyxerr[Debug::LATEX] << "TeXDeeper... " << &*pit << endl;
ParagraphList::iterator par = pit;
@ -298,10 +301,10 @@ TeXDeeper(Buffer const * buf,
par->params().depth() == pit->params().depth()) {
if (par->layout()->isEnvironment()) {
par = TeXEnvironment(buf, paragraphs, par,
os, texrow);
os, texrow, runparams);
} else {
par = TeXOnePar(buf, paragraphs, par,
os, texrow, false);
os, texrow, runparams, false);
}
}
lyxerr[Debug::LATEX] << "TeXDeeper...done " << &*par << endl;
@ -314,7 +317,8 @@ ParagraphList::iterator
TeXEnvironment(Buffer const * buf,
ParagraphList const & paragraphs,
ParagraphList::iterator pit,
ostream & os, TexRow & texrow)
ostream & os, TexRow & texrow,
LatexRunParams const & runparams)
{
lyxerr[Debug::LATEX] << "TeXEnvironment... " << &*pit << endl;
@ -374,7 +378,7 @@ TeXEnvironment(Buffer const * buf,
}
ParagraphList::iterator par = pit;
do {
par = TeXOnePar(buf, paragraphs, par, os, texrow, false);
par = TeXOnePar(buf, paragraphs, par, os, texrow, runparams, false);
if (par != paragraphs.end()&& par->params().depth() > pit->params().depth()) {
if (par->layout()->isParagraph()) {
@ -396,7 +400,8 @@ TeXEnvironment(Buffer const * buf,
os << '\n';
texrow.newline();
}
par = TeXDeeper(buf, paragraphs, par, os, texrow);
par = TeXDeeper(buf, paragraphs, par, os, texrow,
runparams);
}
} while (par != paragraphs.end()
&& par->layout() == pit->layout()
@ -438,6 +443,7 @@ TeXOnePar(Buffer const * buf,
ParagraphList const & paragraphs,
ParagraphList::iterator pit,
ostream & os, TexRow & texrow,
LatexRunParams const & runparams,
bool moving_arg,
string const & everypar)
{
@ -547,7 +553,8 @@ TeXOnePar(Buffer const * buf,
if (style->optionalargs == 1) {
InsetOptArg * it = optArgInset(*pit);
if (it)
it->latexOptional(buf, os, false, false);
it->latexOptional(buf, os, runparams,
false, false);
}
else
os << style->latexparam();
@ -566,7 +573,7 @@ TeXOnePar(Buffer const * buf,
os << everypar;
bool need_par = pit->simpleTeXOnePar(buf, bparams,
outerFont(pit, paragraphs),
os, texrow, moving_arg);
os, texrow, runparams, moving_arg);
// Make sure that \\par is done with the font of the last
// character if this has another size as the default.
@ -689,6 +696,7 @@ void latexParagraphs(Buffer const * buf,
ParagraphList const & paragraphs,
ostream & os,
TexRow & texrow,
LatexRunParams const & runparams,
bool moving_arg,
string const & everypar)
{
@ -738,18 +746,19 @@ void latexParagraphs(Buffer const * buf,
if (layout->is_environment) {
par = TeXOnePar(buf, paragraphs, par, os, texrow,
moving_arg, everypar);
runparams, moving_arg, everypar);
} else if (layout->isEnvironment() ||
!par->params().leftIndent().zero())
{
par = TeXEnvironment(buf, paragraphs, par, os, texrow);
par = TeXEnvironment(buf, paragraphs, par, os,
texrow, runparams);
} else {
par = TeXOnePar(buf, paragraphs, par, os, texrow,
moving_arg, everypar);
runparams, moving_arg, everypar);
}
} else {
par = TeXOnePar(buf, paragraphs, par, os, texrow,
moving_arg, everypar);
runparams, moving_arg, everypar);
}
}
// It might be that we only have a title in this document

View File

@ -19,6 +19,7 @@
class Buffer;
class BufferParams;
class TexRow;
class LatexRunParams;
class LyXLex;
///
@ -65,8 +66,9 @@ void latexParagraphs(Buffer const * buf,
ParagraphList const & paragraphs,
std::ostream & ofs,
TexRow & texrow,
LatexRunParams const &,
bool moving_arg,
string const & everypar = string());
string const & everypar = string());
/// read a paragraph from a .lyx file. Returns number of unrecognised tokens
int readParagraph(Buffer & buf, Paragraph & par, LyXLex & lex);

View File

@ -483,6 +483,7 @@ void Paragraph::Pimpl::simpleTeXSpecialChars(Buffer const * buf,
BufferParams const & bparams,
ostream & os,
TexRow & texrow,
LatexRunParams const & runparams,
bool moving_arg,
LyXFont & font,
LyXFont & running_font,
@ -579,7 +580,7 @@ void Paragraph::Pimpl::simpleTeXSpecialChars(Buffer const * buf,
running_font = basefont;
}
int tmp = inset->latex(buf, os, moving_arg,
int tmp = inset->latex(buf, os, runparams, moving_arg,
style.free_spacing);
if (close)

View File

@ -153,7 +153,7 @@ struct Paragraph::Pimpl {
///
void simpleTeXSpecialChars(Buffer const *, BufferParams const &,
std::ostream &, TexRow & texrow,
bool moving_arg,
LatexRunParams const &, bool moving_arg,
LyXFont & font, LyXFont & running_font,
LyXFont & basefont,
LyXFont const & outerfont,

View File

@ -1872,6 +1872,7 @@ int LyXTabular::TeXCellPostamble(ostream & os, int cell) const
int LyXTabular::TeXLongtableHeaderFooter(ostream & os, Buffer const * buf,
LatexRunParams const & runparams,
bool fragile, bool fp) const
{
if (!is_long_tabular)
@ -1886,7 +1887,7 @@ int LyXTabular::TeXLongtableHeaderFooter(ostream & os, Buffer const * buf,
}
for (int i = 0; i < rows_; ++i) {
if (row_info[i].endhead) {
ret += TeXRow(os, i, buf, fragile, fp);
ret += TeXRow(os, i, buf, runparams, fragile, fp);
}
}
if (endhead.bottomDL) {
@ -1908,7 +1909,7 @@ int LyXTabular::TeXLongtableHeaderFooter(ostream & os, Buffer const * buf,
}
for (int i = 0; i < rows_; ++i) {
if (row_info[i].endfirsthead) {
ret += TeXRow(os, i, buf, fragile, fp);
ret += TeXRow(os, i, buf, runparams, fragile, fp);
}
}
if (endfirsthead.bottomDL) {
@ -1926,7 +1927,7 @@ int LyXTabular::TeXLongtableHeaderFooter(ostream & os, Buffer const * buf,
}
for (int i = 0; i < rows_; ++i) {
if (row_info[i].endfoot) {
ret += TeXRow(os, i, buf, fragile, fp);
ret += TeXRow(os, i, buf, runparams, fragile, fp);
}
}
if (endfoot.bottomDL) {
@ -1948,7 +1949,7 @@ int LyXTabular::TeXLongtableHeaderFooter(ostream & os, Buffer const * buf,
}
for (int i = 0; i < rows_; ++i) {
if (row_info[i].endlastfoot) {
ret += TeXRow(os, i, buf, fragile, fp);
ret += TeXRow(os, i, buf, runparams, fragile, fp);
}
}
if (endlastfoot.bottomDL) {
@ -1972,7 +1973,7 @@ bool LyXTabular::isValidRow(int const row) const
int LyXTabular::TeXRow(ostream & os, int const i, Buffer const * buf,
bool fragile, bool fp) const
LatexRunParams const & runparams, bool fragile, bool fp) const
{
int ret = 0;
int cell = GetCellNumber(i, 0);
@ -1989,7 +1990,7 @@ int LyXTabular::TeXRow(ostream & os, int const i, Buffer const * buf,
if (rtl)
os << "\\R{";
ret += inset->latex(buf, os, fragile, fp);
ret += inset->latex(buf, os, runparams, fragile, fp);
if (rtl)
os << '}';
@ -2007,8 +2008,8 @@ int LyXTabular::TeXRow(ostream & os, int const i, Buffer const * buf,
}
int LyXTabular::latex(Buffer const * buf,
ostream & os, bool fragile, bool fp) const
int LyXTabular::latex(Buffer const * buf, ostream & os,
LatexRunParams const & runparams, bool fragile, bool fp) const
{
int ret = 0;
@ -2082,7 +2083,7 @@ int LyXTabular::latex(Buffer const * buf,
os << "}\n";
++ret;
ret += TeXLongtableHeaderFooter(os, buf, fragile, fp);
ret += TeXLongtableHeaderFooter(os, buf, runparams, fragile, fp);
//+---------------------------------------------------------------------
//+ the single row and columns (cells) +
@ -2090,7 +2091,7 @@ int LyXTabular::latex(Buffer const * buf,
for (int i = 0; i < rows_; ++i) {
if (isValidRow(i)) {
ret += TeXRow(os, i, buf, fragile, fp);
ret += TeXRow(os, i, buf, runparams, fragile, fp);
if (is_long_tabular && row_info[i].newpage) {
os << "\\newpage\n";
++ret;

View File

@ -24,6 +24,7 @@
class InsetTabular;
class BufferParams;
class LaTeXFeatures;
class LatexRunParams;
class Buffer;
class LyXLex;
@ -290,7 +291,7 @@ public:
///
void Read(Buffer const *, LyXLex &);
///
int latex(Buffer const *, std::ostream &, bool, bool) const;
int latex(Buffer const *, std::ostream &, LatexRunParams const &, bool, bool) const;
///
int docbook(Buffer const * buf, std::ostream & os, bool mixcont) const;
///
@ -559,12 +560,12 @@ private:
int TeXCellPostamble(std::ostream &, int cell) const;
///
int TeXLongtableHeaderFooter(std::ostream &, Buffer const * buf,
bool fragile, bool fp) const;
LatexRunParams const &, bool fragile, bool fp) const;
///
bool isValidRow(int const row) const;
///
int TeXRow(std::ostream &, int const row, Buffer const * buf,
bool fragile, bool fp) const;
LatexRunParams const &, bool fragile, bool fp) const;
///
// helper function for ASCII returns number of newlines
///