Commit Graph

999 Commits

Author SHA1 Message Date
Georg Baum
5dc9568f8d Native support for \smash[t] and \smash[b]
This is a follow-up of bug #8967. The implementation is self-explaining, the
only part which needs a comment is lyx2lyx: Since a 100% correct solution is
not possible, it has been decided not to switch amsmath off in the forward
conversion if no other ams command than \smash[t] and \smash[b] is used, but
to consider it a bug that older versions do not load amsmath automatically for
these commands. In the backward direction it is easy to keep the document
compilable, so just do that.
2014-05-27 22:13:58 +02:00
Georg Baum
3c1b79dd5b Update tex2lyx test references
This is needed after c668ebf61. tex2lyx itself was already updated, and I
verified that the new output is correct.
2014-05-12 21:23:47 +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
Georg Baum
351363c599 Fix C++11 test
Thanks Vincent for noticing. The old test was slightly off, the C++98 standard
guarantees that __cplusplus is defined as 199711L, not 19971L.
2014-04-29 21:00:02 +02:00
Georg Baum
0c0e16c61c Make iparserdocstream more like std::istream
In C++98 std::istream does not use an operator bool(), but an operator
void*() instead, which prevents some unwanted conversions (this is one
possible implementation of the safe bool idiom).
In C++11 std::istream uses explicit operator bool, which prevents the unwanted
conversions using a new language feature.

This change does not have any effect on correct code, but prevents some
mistakes.
2014-04-22 22:03:31 +02:00
Jean-Marc Lasgouttes
5c32dc85d5 Fix various warnings issued by clang++.
* remove unused class TexStream.

* remove unused virtual method Inset::cellXOffset

* remove second argument of FileDialog constructor, which was actually
  not used

* remove some dead local code

* remove some unused private members of classes

* in InsetMathNest::updateBuffer, fix the logic of a test
2014-04-22 00:04:04 +02:00
Benjamin Piwowarski
14de3aa49b CMake install and bundling improvements (esp. OS X)
This patch improves the cmake bundling process:
- reworked bundle handling for OS X: only when installing resources are copied, otherwise
only the smallest bundle is built
- on OS X, the utility programs (tex2lyx) are now installed in the right location
- it removes some unneeded BUNDLE DESTINATION
- it provides a basic support for QT plugins inclusion
- it properly builds a disk image on OS X (only the background image is missing)
- it fixes the library paths for all executables (not only LyX)
- Use the COPYING file for cmake install license
2014-04-21 11:51:04 -04:00
Georg Baum
07afd76b7c Fix compilation with libc++
libc++ (http://libcxx.llvm.org/) is used on OS X with newer XCode.
The patch is from Benjamin Piwowarski <benjamin.piwowarski@lip6.fr>, I only
added more comments.
The changes regarding implicit conversion to bool of std::iostream work
because both the C++98 and C++11 standards guarantee that boolean evaluation
of streams returns !fail(). See e.g.
http://stackoverflow.com/questions/1334858/why-dont-iostream-objects-overload-operator-bool
for details.
2014-03-04 23:27:57 +01:00
Georg Baum
89c7d0eea3 Remove unsupported optional argument.
Thanks Jürgen for insisting. The \caption* command of long tables does indeed
not support optional arguments.
2014-02-25 20:05:07 +01:00
Kornel Benko
3369de6d7c Added test for algo2e tex2lyx conversion
Testfile from Jürgen Spitzmüller
2014-01-28 13:58:28 +01:00
Juergen Spitzmueller
f76a8c8ab1 tex2lyx: support algorithm2e (#8728) 2014-01-28 12:44:22 +01:00
Georg Baum
99cdabd206 Fix writer2latex quote handling (bug #8903)
writer2latex surrounds quotes by braces which we skip to avoid useless ERT.
I broke this in 25fe87e5 which made Parser::next_next_token() not recognize
that it needed to parse one more token. If we had a unit test for the Parser
class it would probably have detected that. Now we have at least a test for
the special quote.
2013-12-11 21:54:26 +01:00
Georg Baum
14a5d07df6 Fix encoding for copying LaTeX from clipboard
If we call tex2lyx on a temporary file created from the clipboard, the
file is always in utf8 encoding, without any temporary changes, even if it
contains encoding changing LaTeX commands. Therefore, we must tell tex2lyx
to use a fixed utf8 encoding for the whole file, and this is done using the
new latexclipboard format. Previously, tex2lyx thought the encoding was
latin1.
As a side effect, the -e option is now also documented in the man page.
2013-11-11 21:52:14 +01:00
Vincent van Ravesteijn
c75db6757a Remove the TEX2LYX define when compiling tex2lyx 2013-09-29 15:26:23 +02:00
Jean-Marc Lasgouttes
72c13323d8 Remove dependency on NO_LAYOUT_CSS #define in Layout.cpp
Remove all traces of this #define.
2013-09-29 15:26:15 +02:00
Jean-Marc Lasgouttes
fa5519d4f0 Move tex2lyx dummy implementations in their own file.
Also try to document their use.
2013-09-29 15:26:13 +02:00
Jean-Marc Lasgouttes
9a1e972edb Remove dependency on TEX2LYX #define in ModuleList.cpp 2013-09-29 15:26:12 +02:00
Jean-Marc Lasgouttes
aef31d666e Remove dependency on TEX2LYX #define in Lexer.cpp 2013-09-29 15:26:10 +02:00
Georg Baum
592deaa423 Remove layout and tex2lyx tests from make check
These tests need a built and configured LyX, so they do not work in the
distcheck target. They can now be called with make alltests.
2013-09-09 21:00:11 +02:00
Kornel Benko
f2553ebf6c Cmake build tests: Threadsafety and test-labeling
The tests are now more robust if ctest uses '-j' (number of threads) parameter.
a.) keytests are running in sequence and in one thread only, no other thread running
b.) tex2lyx tests are locking in respect to each other
c.) Test gets one or more labels, so that we can select
        ctest -L url
  to run tests labeled url
d.) New macro settestlabel() to add labels to a test
2013-09-07 09:25:02 +02:00
Kornel Benko
29381d2b52 Copyright 2013-08-26 22:06:01 +02:00
Kornel Benko
e6f2598323 Cmake build tests: Unify use of userdir
Forgotten in commit 788e2b1ac8
2013-08-25 11:45:26 +02:00
Kornel Benko
788e2b1ac8 Cmake build tests: Unify use of userdir
While some test runns lyx-exe, we need userdir be
different from default. All relevant tests should use the same directory.
2013-08-25 11:41:10 +02:00
Kornel Benko
c5d0e818e6 Cmake tests renaming. tex2lyx2lyx/roundtrip/ => tex2lyx/cmplyx/
This one was forgotten
2013-08-23 02:19:09 +02:00
Kornel Benko
723cda15d3 tex2lyx roundtrip: ignore version string while comparing lyx files 2013-08-04 16:47:03 +02:00
Kornel Benko
d3245d4cd2 tex2lyx roundtrip: expand diff to bu usefull to files created by lyx
Otherwise the comparision used by tex2lyx2lyx-tests would fail
2013-08-04 15:57:01 +02:00
Kornel Benko
39bef61e84 tex2lyx roundtrip: Ignore the lyx-version which created
When comparing the contents of two lyx-files, we should not care about the specific version. Later, this can be extended to also not care whether the file is produced by tex2lyx, lyx2lyx, or LyX.

Modified-By: Vincent van Ravesteijn <vfr@lyx.org>
2013-08-04 15:42:51 +02:00
Georg Baum
c3aad9624f Fix tests which were forgotten in c7cdac6561. 2013-07-17 21:08:03 +02:00
Uwe Stöhr
c7cdac6561 Preamble.cpp: fix bug #8723 2013-07-16 23:07:46 +02:00
Georg Baum
85e635d2e3 Fix failing test caused by 89b2c54c00.
Actually, the old reference was wrong, since it misparsed IPA short cuts as
spaces. I verified that the re-exported .tex is correct.
2013-07-16 22:53:25 +02:00
Georg Baum
822e171762 Fix inconsistent version in .lyx files (#7951)
LyX, lyx2lyx and tex2lyx produce now all the same version indicator consisting
only of the major and minor version. It is not decided yet whether future
development versions will add a -dev suffix, but for 2.1.0 this change fixes
the inconsistencies.
2013-07-13 16:02:26 +02:00
Vincent van Ravesteijn
d15bc5ef53 Update tex2lyx testcases to latest fileformat 2013-06-04 21:56:51 +02:00
Jean-Marc Lasgouttes
a2546357eb Update chunk handling to use new inset
At the same time, rename parse_noweb to parse_chunk.
2013-06-03 12:36:35 +02:00
Jean-Marc Lasgouttes
3a985a228c tex2lyx does not use LYXERR, but basic cerr stream 2013-05-31 11:38:41 +02:00
Vincent van Ravesteijn
a3c864102a CMake: Remove libintl 2013-05-30 22:10:01 +02:00
Jean-Marc Lasgouttes
d7e2705228 Get rid of all traces of libintl.
This requires to re-add some tests in configure.ac.

Note that the code to generate a Makefile in po/ has been kept.
2013-05-30 22:10:01 +02:00
Uwe Stöhr
ea2d5947e9 support to set Tibetan as document language
- polyglossia supports http://en.wikipedia.org/wiki/Standard_Tibetan so we can support it too
- fileformat change
2013-05-28 23:40:17 +02:00
Georg Baum
b188e74cd6 Remove include test with space
Unfortunately automake does not support file names with spaces for files in
EXTRA_DIST: These file names are put into a shell list, and it is impossible
quote the name in a way that works both with the shell and with make.
Therefore I removed the corresponding test file.
2013-05-26 16:47:17 +02:00
Georg Baum
3ebf1c9bac Fix tex2lyx include output for roundtrip
In roundtrip mode, tex2lyx produces documents with extension lyx.lyx, so that
the original files are not overwritten on re-export. This was not done for
included documents which were converted, and this broke 'make dist'.
2013-05-26 16:07:56 +02:00
Jean-Marc Lasgouttes
f04c7711b0 Fix empty width support for Box inset
* InsetBox and GuiBox: Use proper empty length instead of the broken -9.99col% trick
* some slight changes to the logic of GuiBox to make sure that values are set as needed.
* lengthToWidget(): handle properly the empty length case. All the other related Qt helpers did it already, it was probably an oversight. Also set the default_unit parameter as optional (not needed in this patch actually, but I got carried away :)
* allow generating LaTeX code for an empty length, since some broken code does that.
2013-05-24 15:44:59 +02:00
Stephan Witt
0cd85602ed fix whitespace: avoid mixed tabs and spaces 2013-05-23 07:55:09 +02:00
Vincent van Ravesteijn
b701eea8c8 Update tex2lyx test cases to format 471 2013-05-20 14:39:19 +02:00
Julien Rioux
cde541d785 New \cite_engine_type default.
The default citation capability of LaTeX is not a true numerical
citation engine, rather it uses a mixture of labels/numbers. Thus
we now distinguish them: "numerical" always increments the bibitem
counter and uses its value as a numerical citation label, while
"default" only uses the bibitem counter when no label is provided.

LyX file format incremented to 471.
2013-05-16 20:39:23 +02:00
Georg Baum
7bdc34a987 Implement forced local layouts
These should be used if any new style needs to be introduced in the stable
2.1 series: If the ForceLocal flag of the style is set, it will always be
written to the document header, so that even older 2.1 versions can read
and correctly output the document.
2013-05-15 07:19:49 +02:00
Georg Baum
b79c88034e Add test for Layout::write()
When running the test, you'll get the following messages:

Testing ../../src/../lib/layouts/siamltex.layout...
Layout.cpp (268): Cannot copy unknown style `Enumerate'
Testing ../../src/../lib/layouts/svglobal.layout...
Cannot delete style `Dedication'
Testing ../../src/../lib/layouts/svjog.layout...
Cannot delete style `Dedication'
Testing ../../src/../lib/layouts/svprobth.layout...
Cannot delete style `Dedication'

These are no errors of Layout::write(), but they indicate problems in the
definition of the layout files.

Kornel, it would be nice if you could do the cmake part.
2013-05-13 21:53:28 +02:00
Lars Gullik Bjønnes
704328d348 Remove ; from end of function definitions 2013-05-12 13:04:18 +02:00
Uwe Stöhr
1b32a0502e Revert "tex2lyx/text.cpp: fix a typo spotted by clang"
This reverts commit 055b425b64.

This requires much more work and i don't have time to do this now
2013-05-06 01:54:17 +02:00
Uwe Stöhr
055b425b64 tex2lyx/text.cpp: fix a typo spotted by clang 2013-05-06 01:35:38 +02:00
Georg Baum
c61ef8b205 Support \caption* (bug #3209)
This was a low hanging fruit which would have to wait for a long time because
of a file format change if it was not implemented before 2.1.
2013-03-22 22:23:38 +01:00
Uwe Stöhr
9aeb084a22 tex2lyx: we support now \framebox without options
-> this is \fbox

- also update the tex2lyx example file result
2013-03-22 02:00:25 +01:00