Commit Graph

1064 Commits

Author SHA1 Message Date
Jean-Marc Lasgouttes
e4fe294bdc Make builds reproducible
We do not really need to use __TIME__ and __DATE__, which prevent from making LyX builds reproducible.

Fixes bug #9415.
2015-03-26 18:14:45 +01:00
Jean-Marc Lasgouttes
66fa801e74 Improve support for on screen length calculation
The computation of length on screen depend in particular of the computation of the size of an em. Many places of the code used to rely on the width of the M character, which is not really correct:
http://en.wikipedia.org/wiki/Em_%28typography%29

In digital typography, the best value to use is the point size of the font.

* Implement FontMetrics::em(), which returns the value in pixels of the EM unit.
 Convert code to use it.

* Introduce Length::inPixel(MetricsBase const &), which takes the textwidth and em information from the MetricsBase object. Convert code to use it.

* Fix several places where Length::inPixel is used without a proper em value.

* add mathed_font_em() helper function. It should eventually be removed like some other functions in MathSupport.

* Add dummy implementation of FontMetrics to tex2lyx for linking purposes.
2015-03-26 17:10:15 +01:00
Georg Baum
49ac79100b Make InsetSpecialChar names more consistent
This is the rersult of a discussion on the list. Now all special characters
have meaningful names, and it is clear that the LyX file syntax is not LaTeX.
2015-03-23 21:28:04 +01:00
Georg Baum
19297a891c Fix tex2lyx import of \LaTeXe
Previously, it did generate an invalid SpecialChar inset.
2015-03-23 20:52:51 +01:00
Georg Baum
d752334ec4 Fix tex2lyx script output
tex2lyx did not use the InsetLayout for the script insets, so it did not know
that it had to use Plain Layout. However, there is still a possible pitfall:
InsetScript uses a hard coded plain layout for the InsetText constructor, so
if anybody would remove ForcePlain 1 and MultiPar false from the InsetLayout
then LyX would still write script insets with plain layout, but tex2lyx would
output standard layout again.
2015-03-11 22:20:44 +01:00
Georg Baum
d8ed62f496 Update tex2lyx test references
tex2lyx outputs the correct layout ("Plain Layout") for captions since
9d824a04d1. Previously, it did output  "Standard", which was wrong.
2015-03-11 21:02:59 +01:00
Georg Baum
3e9e6e344a Replace automatic logofication with insets
Previously, LyX did replace some words with typeset logos, and there was no
way to prvent this except putting them, in ERT (bug #4752). Now we have
special insets for these words, and standard text is left alone.
2015-03-01 11:16:57 +01:00
Georg Baum
e76fc73040 Fix \nobreakdash- roundtrip in moving args
Previously, tex2lyx did not remove the \protect which is output by LyX in
front of \nobreakdash- if needed. Now tex2lyx removes it unconditionally (like
it does elsewhere), because LyX will add it if needed.
2015-02-27 22:06:11 +01:00
Georg Baum
8aa37c43a1 Fix plaintext output of dashes (bug #3647)
Previously, consecutive dashes in .lyx files were combined to endash and emdash
in some cases, and in other cases they were output as is. This made the code
complicated, and resulted in inconsitencies ((bug #3647).
Now, a dash in a .lyx file is always a dash in the output, for all flavours.
The special handling is moved to the input side, so that you still get an
endash if you type two hyphens. If needed, this can be changed or made
customizable without the need to update the file format again. Many thanks
for the fruitful mailing list dicsussion, which contributed significantly to
the final version.
2015-02-24 22:06:12 +01:00
Georg Baum
7178f98b0f Fix tex2lyx parsing of consecutive hyphens
tex2lyx was already behaving as if bug #3647 was fixed, but currently -- and
--- have the same special meaning in LyX as in LaTeX.
2015-02-01 14:03:58 +01:00
Georg Baum
3120ff8e9f Fix tex2lyx tests for 23e8db3e5
The textcyr test did not work anymore, since the output of
"CYRILLIC SMALL LETTER VE" changed from \textcyr{\char226} to \textcyr{\cyrv}.
The the old version is now converted to ERT. In theory it could also be
converted to "CYRILLIC SMALL LETTER VE", but this would mean to maintain an
extra list, which is not worth the effort.
2015-02-01 13:12:45 +01:00
Georg Baum
19f3f630bc Remove unused declaration 2015-01-14 21:44:28 +01:00
Georg Baum
7b48e2aac0 Start qt event loop for commandline usage
This is needed since src/support calls lots of qt code, and some parts of it
(e.g. QFileInfo) require a running event loop. This fixes bug #4917 which is
a symptom of the problem.
The fix is to create a QCoreApplication for tex2lyx, lyxclient and LyX running
without GUI. In the future this could be extended, i.e. to split up the
frontend Application class in a GUI and a console class, and having the
console class use LyXConsoleApp in the same way as Application now uses
GuiApplication. If that is done, one could also think of moving
support/ConsoleApplication to frontend/console/ConsoleApplication.
2015-01-11 14:06:17 +01:00
Georg Baum
ca6fba31fb Remove direct calls of exit()
This is a preparation for using QCoreApplication.
2015-01-09 21:43:45 +01:00
Georg Baum
9c1504a416 Update references after 706960eba
The generated output is correct, since the lyx2lyx forward conversion is empty.
2015-01-09 21:05:42 +01:00
Georg Baum
59b705dcd9 Move global variable to preamble
This will be needed in the future, when I need to parse the preamble twice
for detecting japanese encoding (bug #8218).
2015-01-06 19:21:34 +01:00
Georg Baum
3f72a026cc Fix parsing of verbatim options (bug #9113)
Parser::verbatimOption() did swallow backslashes previously. The similar code
in Parser::verbatim_item() was already correct.
2015-01-03 20:45:06 +01:00
Georg Baum
b1bfbfb3f9 Adjust subfigure and subcaption options 2015-01-03 18:43:01 +01:00
Georg Baum
1d4fb5ac7d Parse post command argument insets (bug #8473)
This is now very easy with the new InsetArgument infrastructure.
2014-12-30 18:37:08 +01:00
Georg Baum
d1e530cf5d Handle \textgreek commands from unicodesymbols
This is the second part of bug #8553: The symbols defined in unicodesymbols
are now detected correctly and converted to unicode, so no ERT anymore.
2014-12-30 18:12:35 +01:00
Georg Baum
bf1006a22c Fix misparsing of \textgreek without polyglossia
This is the first part of bug #8553. \textgreek was interpreted as the
polyglossia version even if polyglossia was not used. Now it is not recognized
at all and converted to ERT, but this ensures at least correct LaTeX output.
2014-12-30 17:44:08 +01:00
Georg Baum
b0361fb3c5 tex2lyx: Run configure.py if needed (bug #8539)
Since tex2lyx reads some LyX config files it needs to run configure.py if
they do not exist or are out of date.
2014-12-29 23:46:25 +01:00
Georg Baum
c1c439b94d Handle unknown table column specifiers (bug #9311)
Previously tex2lyx did ignore table columns if the column specifier was
unknown. This can lead to data loss, and now it does not ignore these columns,
but assumes that the column specifiers use only once character. This can still
lead to data loss, but less often.
2014-12-29 22:54:06 +01:00
Georg Baum
cd3b040a70 Write fixed encoding to LyX file (bug #9178)
If the user gave the -fixednec argument to tex2lyx then set that encoding as
LaTeX input encoding in the generated LyX file. Otherwise, included .bib files
could be interpreted using a wrong encoding.
2014-12-29 22:29:20 +01:00
Georg Baum
ff9b4a3834 Use new argument inset code for environments
This removes another instance of the limitation solved by file format 446:
The order of optional and required arguments is not fixed anymore.
2014-12-29 22:06:29 +01:00
Georg Baum
5bfd1c22d2 Skip missing optional argument insets in tex2lyx
Optional arguments are optional, so if one is missing, do not stop the parsing,
but continue with the next argument (it might be a required one).
2014-12-29 21:54:15 +01:00
Georg Baum
e15d3d35cb Reduce caption hardcoding
Now we can handle all types of captions defined in layout files or modules.
This does also mean that \captionabove and \captionbelow are only recognized
in KOMA-classes and not always anymore, but this is correct, since these
captions would not work in other document classes anyway.
2014-12-27 18:15:07 +01:00
Georg Baum
eda5f69cc0 Revert e01886327d
Sorry, this was nonsense.
2014-12-27 17:03:39 +01:00
Georg Baum
e01886327d Output caption insets collapsed
Like all other collapsable insets, there is not reason to treat captions
specially.
2014-12-27 16:10:11 +01:00
Georg Baum
f4417e8125 Remove InsetArgument 999 workaround
Since we iterate through all arguments we can as well compute the correct id
directly.
2014-12-27 15:17:11 +01:00
Georg Baum
0c90821138 Parse starred InsetLayout correctly
Previously, an InsetLayout was not found if the LaTeX name was starred, e.g.
for "\caption*".
2014-12-27 15:17:10 +01:00
Georg Baum
614862fccc Move cjk check out of the loop
According to the indentation this was probably a merge error, and the check is
only needed once.
2014-12-27 15:17:10 +01:00
Georg Baum
16eb4f1ed7 Adjust tex2lyx InsetArgument to format 446
tex2lyx does now allow mixed order of required and optional arguments.
2014-12-27 15:17:09 +01:00
Enrico Forestieri
1b0cbb6932 Fix building with cmake on cygwin.
Add required libraries for the link stage.
2014-12-26 17:00:23 +01:00
Georg Baum
903917f3b8 Add tex2lyx test for KOMA-Script classes
In the future this test case should contain all KOMA-Script features.
Currently, it tests just \captionabove anmd \captionbelow.
2014-12-23 22:33:32 +01:00
Georg Baum
bb87e0422a Revert parts of 7e69ac220d
This fixes the tex2lyx test test-refstyle-theorems.tex. It seems that the
intent of the fix was to remove a \protect in front of a \caption,
\captionabove or \captionbelow, but the implementation did not really do that.
Furthermore, it is not clear in which cases a \protect in front of a caption
needs to removed, and in which cases it needs to be kept: After looking at the
LyX sources I could not see that caprions are always output with \protect.
2014-12-22 21:32:45 +01:00
Uwe Stöhr
0d63bdfc16 tex2lyx/text.cpp: bring back a comment as discussed 2014-12-04 00:57:14 +01:00
Uwe Stöhr
7e69ac220d tex2lyx: support for KOMA-script's \caption* commands
- To my knowledge tex2lyx supports now all caption constructs provided by LyX.
- InsetArgument is correct here, I therefore deleted the FIXME.
2014-12-01 02:57:12 +01:00
Jean-Marc Lasgouttes
8d6d21c6d9 Add new variables lyx_build_date/time
These are now in version.cpp. The build machinery should therefore make sure
that version.cpp is recompiled at every compilation.

These variables are now referred to by the other places that made use of __DATE__ and __TIME__.
2014-11-25 18:58:35 +01:00
Uwe Stöhr
bfc4af2d01 tex2lyx/text.cpp: add missing part of a comment 2014-11-25 00:53:35 +01:00
Uwe Stöhr
1427b6fe31 tex2lyx: support for glue lengths in InsetSpace 2014-11-25 00:50:39 +01:00
Uwe Stöhr
489cdae255 tex2lyx: support relative lengths in \vspace and \hspace 2014-11-23 04:56:47 +01:00
Uwe Stöhr
c2e0f22385 tex2lyx/Preamble.cpp: add support for all \defskip lengths
- support for percentage length was missing and the fix is really that simple
2014-11-23 03:28:07 +01:00
Uwe Stöhr
02b2cd50ed tex2lyx/TODO.txt: \=*{char} is already supported by tex2lyx 2014-11-23 01:30:13 +01:00
Uwe Stöhr
d179ef455c tex2lyx/TODO.txt: the UGM fonts are already fully supported 2014-11-23 00:40:47 +01:00
Uwe Stöhr
2a1ab8b6f0 tex2lyx/Preamble.cpp: whitespace fix
- revert unnecessary change from previous commit
2014-11-20 02:03:06 +01:00
Uwe Stöhr
5c9667d8b8 tex2lyx: support for the libertine fonts
- all libertine font variants are now supported
2014-11-20 02:01:05 +01:00
Uwe Stöhr
ec84cbfb44 tex2lyx: support for \item with opt arg in itemize environment 2014-11-11 01:20:03 +01:00
Uwe Stöhr
20cfef458f tex2lyx/TODO.txt: update file and add information 2014-11-11 01:06:51 +01:00
Uwe Stöhr
9eae2b141d test-insets.lyx.lyx: forgot to commit this in r471889e0 2014-11-10 03:34:01 +01:00