Commit Graph

177 Commits

Author SHA1 Message Date
Enrico Forestieri
7145863466 Generalize control on double blank lines.
We can now tell whether a blank line was just output and so can
avoid outputting another one.
2014-05-20 21:52:29 +02:00
Juergen Spitzmueller
8226453684 Fix crash due to invalid pos 2014-05-20 11:14:13 +02:00
Enrico Forestieri
936773c4f7 Adapt output to the on-screen representation.
LyX assumes that a standard paragraph following an aligned one or
a layout with NextNoIndent==false has to be indented on screen.
This means that in the latex output a blank line has to follow.
In this case there should be no problem as regards extra vertical
space and it simpler and more elegant to simply uncheck "Indent
Paragraph" in the Paragraph settings pane rather than changing
the current logic and allowing to insert a parbreak separator.
2014-05-16 15:39:33 +02:00
Enrico Forestieri
7d5b1fb840 Output a parbreak after a command.
This is what LyX was previously doing. It has no effect on vertical
spacing but, for example, sectioning commands stand out on the output.
The parbreak is not output if an environment follows or the alignment
of the current or next paragraph is changed.
Also remove some superfluous code.
2014-05-14 22:25:15 +02:00
Enrico Forestieri
c668ebf611 Fix bugs #8546 and #9055, and introduce new separator inset.
The algorithm used for breaking a paragraph in LaTeX export is changed
for avoiding spurious blank lines causing too much vertical space.
This change is tied to the introduction of a new inset (with two
different specializations) helping in either outputing LaTeX paragraph
breaks or separating environments in LyX. Both of the above goals were
previously achieved by the ---Separator--- layout and can now be
accomplished by the new inset in a more natural way. As an example,
after leaving an environment by hitting the Return key for two times,
a third return automatically inserts a parbreak inset, which is
equivalent to the old separator layout, i.e., it also introduces a
blank line in the output. If this blank line is not wanted, the
parbreak separator can be changed to a plain separator by a right
click of the mouse. Of course, an environment can still be separated
by the following one by using the Alt+P+Return shortcut (or the
corresponding menu key), but now the plain separator inset is used
instead of the old separator layout, such that no blank line occurs in
the LaTeX output.

Old documents are converted such that the LaTeX output remains unchanged.
As a result of this conversion, the old separator layout is replaced by
the new parbreak inset, which may also appear in places where the old
algorithm was introducing blank lines while the new one is not.
Note that not all blank lines were actually affecting the LaTeX output,
because a blank line is simply ignored by the TeX engine when it occurs
in the so called "vertical mode" (e.g., after an alignment environment).
The old ---Separator--- layout is now gone and old layout files using it
are also automatically converted.

Round trip conversions between old and new format should leave a document
unchanged. This means that the new behavior about paragraph breaking is
not "carried back" to the old format. Indeed, this would need introducing
special LaTeX commands in ERT that would accumulate in roundtrip
conversions, horribly cluttering the document. So, when converting a
modified document to old formats, the LaTeX output may slightly differ in
vertical spacing if the document is processed by an old version of LyX.
In other words, forward compatibility is guaranteed, but not backwards.
2014-05-10 23:25:11 +02:00
Richard Heck
fdbe775b9f This is the result of an audit of all static variables, looking
for possible thread conflicts, of the sort Georg resolved at
6a30211f. I have made static variables const where possible,
and marked cases that looked potentially problematic with the
comment:
	// FIXME THREAD
Many of these definitely are vulnerable to concurrent access, such
as the static variables declared at the start of output_latex.cpp.
Suppose, e.g., we were outputting latex and also displaying the
source of a different document.

I'd appreciate it if others could grep for "FIXME THREAD" and see
if some of these are harmless, or what.
2014-04-21 11:51:57 -04:00
Juergen Spitzmueller
7c1fc6ea75 Include child's own authors when using BufferParams from master. 2014-03-13 06:43:38 +01:00
Juergen Spitzmueller
50bcd6ed7b Use the master buffer's param when compiling as a child (#8893) 2013-11-18 08:46:50 +01:00
Juergen Spitzmueller
a8a2bd463c Force encoding switch when switching from/to CJK, even if we use a customized encoding (#8558) 2013-05-20 13:40:40 +02:00
Juergen Spitzmueller
a78bed06eb revert parts of 53002538 which set wrong local_font 2013-05-20 12:31:46 +02:00
Richard Heck
1b1f8dd235 Audit all the LASSERT calls, and try to do something sensible at
each failure.

There are several places I was not sure what to do. These are marked
by comments beginning "LASSERT:" so they can be found easily. At the
moment, they are at:

Author.cpp:105: // LASSERT: What should we do here?
Author.cpp:121: // LASSERT: What should we do here?
Buffer.cpp:4525:        // LASSERT: Is it safe to continue here, or should we just return?
Cursor.cpp:345:         // LASSERT: Is it safe to continue here, or should we return?
Cursor.cpp:403:         // LASSERT: Is it safe to continue here, or should we return?
Cursor.cpp:1143:                // LASSERT: There have been several bugs around this code, that seem
CursorSlice.cpp:83:     // LASSERT: This should only ever be called from an InsetMath.
CursorSlice.cpp:92:     // LASSERT: This should only ever be called from an InsetMath.
LayoutFile.cpp:303:                     // LASSERT: Why would this fail?
Text.cpp:995:           // LASSERT: Is it safe to continue here?
2013-04-25 17:27:10 -04:00
Juergen Spitzmueller
41060c9723 Allow to specify default argument for layout/inset argments
This default argument is inserted iff no inset argument is present. This is useful particularly for mandatory arguments that need to have a sensible default value.
2013-02-24 11:29:21 +01:00
Jean-Marc Lasgouttes
dc5d63ae24 Fix bug #8049: extra empty line at the end of verbatim environment 2013-01-25 12:18:40 +01:00
Georg Baum
de5e348727 Fix bug #8468: Wrong import of UTF8 CJK.
Actually, the test case showed several problems:
- ERT insets did use layout "Standard", not "Plain Layout"
- The font scale was read correctly, but tex2lyx claimed that it did ignore
  the option "scaled=0.95"
- If a third argument of the CJK environment was given, it caused the whole
  environment to be put in ERT with a broken encoding. This is now fixed for
  the bug test case by using the \font_cjk header variable, but the encoding
  problem still exists for unsupported encodings. I'll file a separate bug
  for that.
- The CJKutf8 package was not handled in the preamble parsing. Therefore the
  chinese comment in the preamble was read with a wrong encoding, and guessing
  the document language did not work.
The new file CJKutf8.tex was created by copying and modifying CJK.tex, but
unfortunately it is impossible to tell git to inherit the history of CJK.tex
for the new file (search the web for git svn copy if you want to know details).
2012-12-30 20:52:49 +01:00
Juergen Spitzmueller
37f41fd4b5 Support for command argument placement after the workarea argument 2012-12-28 11:21:24 +01:00
Juergen Spitzmueller
7af6a7b910 fix latexArgInsets for sequences qith nested paragraphs 2012-12-24 13:02:24 +01:00
Juergen Spitzmueller
3934f4a36f In multi-par sequences, check for arguments in all pars 2012-12-23 17:37:50 +01:00
Juergen Spitzmueller
c3aa718151 Make the \item command in lists customizable 2012-12-19 16:55:22 +01:00
Juergen Spitzmueller
e93f4d470d Possibility to specify a preset argument
This will be needed for beamer plain and fragile frame support.
2012-12-10 14:09:51 +01:00
Juergen Spitzmueller
1500e44cba Support for \item arguments 2012-11-29 15:34:20 +01:00
Juergen Spitzmueller
a7f8fb8c5f Provide option to force a local language switch where a global is not allowed (fixes #8033) 2012-11-28 20:55:21 +01:00
Juergen Spitzmueller
53002538fa Pass local font to arguments and assure pass_thru is inherited 2012-11-28 19:02:07 +01:00
Juergen Spitzmueller
4d1b495139 LaTeXParam and Argument do not necessarily exclude each other 2012-11-26 13:09:54 +01:00
Richard Heck
1252c22fd3 Some minor cleanup of new InsetArguments stuff that I did while
reading the patch....
2012-11-23 20:40:38 -05:00
Juergen Spitzmueller
2e69c66195 InsetArgument revision, first working version 2012-11-19 14:21:02 +01:00
Lars Gullik Bjønnes
6b2232a29c src/*.cpp: reformatting to increase consistency 2012-10-28 17:42:07 +01:00
Juergen Spitzmueller
5b374e0c29 do not output empty language switch commands (bug #8216) 2012-06-24 10:56:08 +02:00
Juergen Spitzmueller
ca16190006 fix bug #8208: missing \end for polyglossia-only languages at buffer end 2012-06-23 15:44:25 +02:00
Juergen Spitzmueller
20d7e088fa less opaque bool naming and consistent use 2012-06-23 15:41:05 +02:00
Jean-Marc Lasgouttes
a756403301 "Performance" fixes suggested by cppcheck
While cppcheck did not turn out any suspicious error messages, using
the "performance" flag highlighted several nitpicks in three categories
 * do not use it++ for iterators, ++it is better
 * do not use size() to test for emptyness, empty() is here
 * do not use "const T" as a function parameter, "const & T" is better

I doubt that any of these is a real performance problem, but the code is cleaner anyway.
2012-05-28 22:42:44 +02:00
Georg Baum
8e8c214bef Fix some bugs related to spaces in math:
- Interpret argument of LFUN_SPACE_INSERT correctly
- Use InsetMathSpace instead of InsetMathSpecialChar for "\ " (bug # 7728)
- Use InsetMathSpace instead of InsetMathChar for ~ (bug # 7728).
  This fixes also the display in LyX (previously a literal ~ was displayed).
Using InsetMathSpace enables also the "Insert Formatting" menu entries.
No file format change is needed, since the LaTeX export is unchanged.
Note that there are still some bugs related to spaces in math:
#7746, #7747, #7749, #7842


git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@39947 a592a061-630c-0410-9148-cb99ea01b6c8
2011-10-23 20:19:49 +00:00
Jürgen Spitzmüller
5118d369e1 finally commit the fix for #7607.
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@39696 a592a061-630c-0410-9148-cb99ea01b6c8
2011-09-17 15:25:14 +00:00
Richard Heck
f76d28c118 Just a bit of cleanup.
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@38933 a592a061-630c-0410-9148-cb99ea01b6c8
2011-06-02 19:55:08 +00:00
Richard Heck
7305ddb6bf Fix some typos.
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@38932 a592a061-630c-0410-9148-cb99ea01b6c8
2011-06-02 19:39:44 +00:00
Enrico Forestieri
d866717ef7 Integrate texrow with otexstream in order to perform automatic line
counting when exporting to latex. This is done for the code comprised
between \begin{document} and \end{document}, while the preamble code
still needs manual calls to TexRow::newline() for registering new lines.


git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@37584 a592a061-630c-0410-9148-cb99ea01b6c8
2011-02-10 20:02:48 +00:00
Enrico Forestieri
1ef605f625 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
Jean-Marc Lasgouttes
3b316bc83f better fix to #7239. Actually the whole switch and kaboodle (see r37229) is needed (otherwise sweave is broken)
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@37322 a592a061-630c-0410-9148-cb99ea01b6c8
2011-01-25 11:22:47 +00:00
Richard Heck
4f4a8203b3 Fix bug #7239, or at least try to do so. We need to output the command
here.


git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@37229 a592a061-630c-0410-9148-cb99ea01b6c8
2011-01-16 19:14:14 +00:00
Vincent van Ravesteijn
8c61911270 Revert r37092. The fix was wrong.
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@37127 a592a061-630c-0410-9148-cb99ea01b6c8
2011-01-06 13:41:50 +00:00
Vincent van Ravesteijn
a7c135b9e1 Fix bug #7096: Wrong LaTeX export for layouts with intitle=true in branches.
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@37092 a592a061-630c-0410-9148-cb99ea01b6c8
2011-01-03 21:23:38 +00:00
Richard Heck
e328ed52c2 Squash warnings. The latter might matter.
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@36953 a592a061-630c-0410-9148-cb99ea01b6c8
2010-12-20 00:57:16 +00:00
Abdelrazak Younes
2ab1601311 Coding style/de-indent
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@36939 a592a061-630c-0410-9148-cb99ea01b6c8
2010-12-18 16:32:29 +00:00
Abdelrazak Younes
41aa051d22 Coding style.
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@36938 a592a061-630c-0410-9148-cb99ea01b6c8
2010-12-18 16:19:05 +00:00
Abdelrazak Younes
3626b46109 Coding style.
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@36937 a592a061-630c-0410-9148-cb99ea01b6c8
2010-12-18 16:11:38 +00:00
Abdelrazak Younes
1614a64e15 TeXOnePar() simplification: use pit_type instead of iterator
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@36936 a592a061-630c-0410-9148-cb99ea01b6c8
2010-12-18 15:57:27 +00:00
Abdelrazak Younes
fd73107054 TeXOnePar() Be on the safe side and reinitialize runparam.par_begin and par_end
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@36935 a592a061-630c-0410-9148-cb99ea01b6c8
2010-12-18 14:04:02 +00:00
Abdelrazak Younes
8e092e6ca6 greatly simplify and comment TeXEnvironment():
* only one for loop
* uses runparams.par_end

InsetInclude and InsetIext: initialize runparams.par_begin and runparams.par_end

Except for a few additonal empty lines the LateX exports are identical for all help files. The reason for the additional empty lines is the more consistent TeXEnvironment() call.


git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@36934 a592a061-630c-0410-9148-cb99ea01b6c8
2010-12-18 13:49:39 +00:00
Abdelrazak Younes
ffea94c5e6 latexParagraphs(): code polish.
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@36933 a592a061-630c-0410-9148-cb99ea01b6c8
2010-12-18 08:31:34 +00:00
Abdelrazak Younes
f48f0ad0bf latexParagraphs(): cleanup a bit and switch to a 'for' loop. Hopefully this should fix the performance problem when exporting very big document to latex.
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@36932 a592a061-630c-0410-9148-cb99ea01b6c8
2010-12-18 08:23:14 +00:00
Abdelrazak Younes
ca91d508b2 LaTeX export small speedup: Introduce RandomAccessList::position() and use it.
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@36931 a592a061-630c-0410-9148-cb99ea01b6c8
2010-12-18 07:37:12 +00:00