2003-11-05 12:06:20 +00:00
|
|
|
// -*- C++ -*-
|
|
|
|
/**
|
|
|
|
* \file output_latex.h
|
|
|
|
* This file is part of LyX, the document processor.
|
|
|
|
* Licence details can be found in the file COPYING.
|
|
|
|
*
|
2008-11-14 15:58:50 +00:00
|
|
|
* \author Lars Gullik Bjønnes
|
2003-11-05 12:06:20 +00:00
|
|
|
*
|
|
|
|
* Full author contact details are available in file CREDITS.
|
|
|
|
*/
|
|
|
|
|
|
|
|
#ifndef OUTPUT_LATEX_H
|
|
|
|
#define OUTPUT_LATEX_H
|
|
|
|
|
2007-07-05 19:19:41 +00:00
|
|
|
#include <utility>
|
|
|
|
|
2006-10-19 16:51:30 +00:00
|
|
|
#include "support/docstream.h"
|
2012-11-19 13:21:02 +00:00
|
|
|
#include "Layout.h"
|
2008-11-16 00:12:21 +00:00
|
|
|
#include "ParagraphList.h"
|
2003-11-05 12:06:20 +00:00
|
|
|
|
2006-10-21 00:16:43 +00:00
|
|
|
|
|
|
|
namespace lyx {
|
|
|
|
|
2003-11-05 12:06:20 +00:00
|
|
|
class Buffer;
|
2007-01-09 19:25:40 +00:00
|
|
|
class BufferParams;
|
|
|
|
class Encoding;
|
2010-06-04 21:50:08 +00:00
|
|
|
class Layout;
|
2007-04-26 08:30:11 +00:00
|
|
|
class Paragraph;
|
2003-11-05 12:06:20 +00:00
|
|
|
class OutputParams;
|
2008-01-25 13:27:08 +00:00
|
|
|
class Text;
|
2003-11-05 12:06:20 +00:00
|
|
|
|
2016-09-25 06:20:34 +00:00
|
|
|
/** Register a language switch when using polyglossia.
|
|
|
|
*/
|
|
|
|
void pushPolyglossiaLang(std::string const & lang);
|
|
|
|
|
|
|
|
/** Unregister the last language switch when using polyglossia.
|
|
|
|
*/
|
|
|
|
void popPolyglossiaLang();
|
|
|
|
|
2012-12-23 16:37:50 +00:00
|
|
|
/** Export optional and required arguments of the paragraph \p par.
|
|
|
|
Non-existing required arguments are output empty: {}.
|
|
|
|
*/
|
2011-02-10 20:02:48 +00:00
|
|
|
void latexArgInsets(Paragraph const & par,
|
Introduce a wrapper class for odocstream to help ensuring that no
blank lines may be inadvertently output. This is achieved by using two
special iomanip-like variables (breakln and safebreakln) in the lyx::
namespace. When they are inserted in the stream, a newline is output
only if not already at the beginning of a line. The difference between
breakln and safebreakln is that, if needed, the former outputs '\n'
and the latter "%\n".
In future, the new class will also be used for counting the number of
newlines issued. Even if the infractrure for doing that is already in
place, the counting is essentially still done the old way.
There are still places in the code where the functionality of the
class could be used, most probably. ATM, it is used for InsetTabular,
InsetListings, InsetFloat, and InsetText.
The Comment and GreyedOut insets required a special treatment and a
new InsetLayout parameter (Display) has been introduced. The default
for Display is "true", meaning that the corresponding latex
environment is of "display" type, i.e., it stands on its own, whereas
"false" means that the contents appear inline with the text. The
latter is the case for both Comment and GreyedOut insets.
Mostly, the only visible effects on latex exports should be the
disappearing of some redundant % chars and the appearing/disappearing
of null {} latex groups after a comment or lyxgreyedout environments
(they are related to the presence or absence of a space immediately
after those environments), as well as the fact that math environments
are now started on their own lines.
As a last thing, only the latex code between \begin{document} and
\end{document} goes through the new class, the preamble being directly
output through odocstream, as usual.
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@37360 a592a061-630c-0410-9148-cb99ea01b6c8
2011-01-29 02:41:13 +00:00
|
|
|
otexstream & os, OutputParams const & runparams,
|
2012-12-28 10:21:24 +00:00
|
|
|
Layout::LaTeXArgMap const & latexargs,
|
|
|
|
std::string const & prefix = std::string());
|
2012-12-23 16:37:50 +00:00
|
|
|
/// Same for multi-par sequences (e.g. merged environments or InsetLayouts)
|
|
|
|
void latexArgInsets(ParagraphList const & pars, ParagraphList::const_iterator pit,
|
|
|
|
otexstream & os, OutputParams const & runparams,
|
2012-12-28 10:21:24 +00:00
|
|
|
Layout::LaTeXArgMap const & latexargs,
|
|
|
|
std::string const & prefix = std::string());
|
2007-01-09 19:25:40 +00:00
|
|
|
/** Export \p paragraphs of buffer \p buf to LaTeX.
|
|
|
|
Don't use a temporary stringstream for \p os if the final output is
|
|
|
|
supposed to go to a file.
|
|
|
|
\sa Buffer::writeLaTeXSource for the reason.
|
|
|
|
*/
|
2003-11-05 12:06:20 +00:00
|
|
|
void latexParagraphs(Buffer const & buf,
|
2008-01-25 13:27:08 +00:00
|
|
|
Text const & text,
|
Introduce a wrapper class for odocstream to help ensuring that no
blank lines may be inadvertently output. This is achieved by using two
special iomanip-like variables (breakln and safebreakln) in the lyx::
namespace. When they are inserted in the stream, a newline is output
only if not already at the beginning of a line. The difference between
breakln and safebreakln is that, if needed, the former outputs '\n'
and the latter "%\n".
In future, the new class will also be used for counting the number of
newlines issued. Even if the infractrure for doing that is already in
place, the counting is essentially still done the old way.
There are still places in the code where the functionality of the
class could be used, most probably. ATM, it is used for InsetTabular,
InsetListings, InsetFloat, and InsetText.
The Comment and GreyedOut insets required a special treatment and a
new InsetLayout parameter (Display) has been introduced. The default
for Display is "true", meaning that the corresponding latex
environment is of "display" type, i.e., it stands on its own, whereas
"false" means that the contents appear inline with the text. The
latter is the case for both Comment and GreyedOut insets.
Mostly, the only visible effects on latex exports should be the
disappearing of some redundant % chars and the appearing/disappearing
of null {} latex groups after a comment or lyxgreyedout environments
(they are related to the presence or absence of a space immediately
after those environments), as well as the fact that math environments
are now started on their own lines.
As a last thing, only the latex code between \begin{document} and
\end{document} goes through the new class, the preamble being directly
output through odocstream, as usual.
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@37360 a592a061-630c-0410-9148-cb99ea01b6c8
2011-01-29 02:41:13 +00:00
|
|
|
otexstream & ofs,
|
2003-11-05 12:06:20 +00:00
|
|
|
OutputParams const &,
|
|
|
|
std::string const & everypar = std::string());
|
|
|
|
|
2008-07-20 17:14:10 +00:00
|
|
|
/** Switch the encoding of \p os from runparams.encoding to \p newEnc if needed.
|
|
|
|
\p force forces this also within non-default or -auto encodings.
|
|
|
|
\return (did the encoding change?, number of characters written to \p os)
|
|
|
|
*/
|
2007-12-17 10:53:38 +00:00
|
|
|
std::pair<bool, int> switchEncoding(odocstream & os,
|
2007-07-05 19:19:41 +00:00
|
|
|
BufferParams const & bparams,
|
2008-07-20 17:14:10 +00:00
|
|
|
OutputParams const &, Encoding const & newEnc,
|
|
|
|
bool force = false);
|
2006-10-21 00:16:43 +00:00
|
|
|
|
2008-11-16 00:12:21 +00:00
|
|
|
/// FIXME: this should not be visible.
|
2010-12-15 20:51:25 +00:00
|
|
|
void TeXOnePar(Buffer const & buf,
|
|
|
|
Text const & text,
|
2010-12-18 15:57:27 +00:00
|
|
|
pit_type pit,
|
2011-02-10 20:02:48 +00:00
|
|
|
otexstream & os,
|
2010-12-15 20:51:25 +00:00
|
|
|
OutputParams const & runparams,
|
|
|
|
std::string const & everypar = std::string(),
|
|
|
|
int start_pos = -1, int end_pos = -1);
|
2008-11-16 00:12:21 +00:00
|
|
|
|
2006-10-21 00:16:43 +00:00
|
|
|
} // namespace lyx
|
|
|
|
|
2003-11-05 12:06:20 +00:00
|
|
|
#endif
|