Commit Graph

423 Commits

Author SHA1 Message Date
Günter Milde
e37e4f537c Fix Ticket #9741 misleading name for font-encoding setting "default".
It would be nice, if the tooltip showed the value of
lyxrc.fontenc, but too complicated for my simple patch.
2016-10-21 09:10:46 +02:00
Richard Heck
c19794a013 These two routines are now redundant. 2016-10-20 23:07:13 -04:00
Richard Heck
7c9e9b4c90 We can now use the cached information instead of tracing the graph. 2016-10-20 23:07:13 -04:00
Richard Heck
014bc7805e Use a typedef for vector<Format const *>, which is what gets used
for lists of exportable and importable formats.
2016-10-20 23:07:13 -04:00
Richard Heck
7fd1a14c1b Since we're now caching this, we can sort it once, rather than
lots of times.
2016-10-20 23:07:13 -04:00
Richard Heck
0b67e103e9 Simple cache for information on exportable formats, since we seem
to access this information a lot.
2016-10-20 23:07:13 -04:00
Guillaume Munch
1f6c451ee3 TexRow for InPreamble
This enables error reporting for the preamble, provided the preamble is written
using the new InPreamble layouts.

In the future, I find it preferable to deprecate the usual preamble in favour of
InPreamble layouts rather than implementing error reporting for the usual
preamble. This requires some improvements to code editing in the buffer view
first (line breaking behaviour, syntax highlighting).
2016-10-17 00:16:59 +02:00
Guillaume Munch
1b4f5970a4 Streamify a docstring
prepare ground for TexRow InPreamble
2016-10-17 00:16:59 +02:00
Guillaume Munch
1f945177b9 Docstringify getLongString in general and preamble snippets in particular
Prepare ground for TexRow InPreamble
2016-10-17 00:16:59 +02:00
Enrico Forestieri
ade098e289 Improve systemlyxdir handling
Do not assume that the /systemlyxdir path prefix in \origin refers
to the system directory of the running instance, but check through
some heuristics what the real system dir is. In this way, a document
in the system dir of any other LyX installation is correctly spotted
and the \origin tag properly updated. For example, one can use an
installed version of lyx to edit a document in the lib/doc dir of a
git repo and obtain the same result as when running lyx in place.
2016-09-17 22:38:27 +02:00
Enrico Forestieri
2aa930bbe8 Fix display and export of some latex macros
Fixes #9742.
2016-09-10 18:32:44 +02:00
Juergen Spitzmueller
b9b9ad3f9e Correct backends() allocation with japanese encoding
Fixes error introduced by ad9887da9c.
2016-08-04 10:01:06 +02:00
Juergen Spitzmueller
ad9887da9c Simplify BufferParams::bufferFormat()
The differentiation of "xetex" and "platex" is not needed here,
is ambiguous and confusing (see #10013). The code that relies on
it can/should get its information otherwise.

Furthermore, polyglossia-exclusive languages now also work with
LuaTeX, since we support LuaTeX + polyglossia.
2016-07-11 11:18:55 +02:00
Juergen Spitzmueller
6bcbd907a4 Clarify some comments wrt XeTeX/LuaTeX (see bug #10013) 2016-07-10 11:13:13 +02:00
Guillaume Munch
670efa8f64 Rationalise includes
Modifying TexRow.h or texstream.h no longer triggers the recompilation of the
complete source tree.
2016-07-04 02:42:17 +02:00
Richard Heck
f46a52d97f Let "provides [fontspec|listings|subfig] 1" work. 2016-06-27 17:18:19 -04:00
Günter Milde
b170b6e40f fix #10199 Non-encodable characters with XeTeX and utf8-plain
XeTeX with TeX fonts is only safe with ASCII input encoding (see #9740)
and we therefore force "ascii" when exporting with XeTeX and 8-bit TeX-fonts.

However, "utf8-plain" is a "power-user" option, which allows to switch off LyX's 
encoding of the LaTeX file: 
keep this also for "XeTeX with TeX fonts".

The user is responsible to ensure all characters can be processed and are 
correctly shown in the output. The provided test sample shows the problems
with this encoding without special measures (like loading fontspec in the
user-preamble or a document class).
2016-06-11 13:57:24 +02:00
Guillaume Munch
b032e2dfaf Replace support/shared_ptr.h and boost::shared_ptr with std::shared_ptr
shared_ptrs now only require the <memory> header.
2016-06-09 15:21:39 +01:00
Pavel Sanda
ba2b86fa5d Introduce basic support for microtype.sty.
https://www.mail-archive.com/lyx-devel@lists.lyx.org/msg192743.html
2016-06-02 22:48:58 -07:00
Guillaume Munch
e56820bea4 Do not save \origin when \save_transient_properties is false (#9958)
\origin is a transient property in the sense that in a collaborative context
each co-author is going to have a different value for it. Moreover, \save_origin
is a global (lyxrc) setting that cannot yet be deactivated for a single file,
but one author's setting is going to impact other authors, even those who have
set save_origin=false.

There is only one location where lyxrc.save_origin produces an effect, modified
by this patch. With this patch, everything happens as if lyxrc.save_origin was
false whenever save_transient_properties=false.

This is not a file format change. When a file has
save_transient_properties=false but an origin is set (for instance a file
produced before this patch) then the origin produces its effect before the file
is saved. This produces the same effect as if the user decided to disable
save_origin between two sessions.
2016-02-09 17:48:16 +00:00
Guillaume Munch
5c2d049996 Add \save_transient_properties parameter (#9841)
Increment LyX format to 504.

With this new parameter, the user can indicate that some other parameters that
are frequently switched must not be recorded in the file (as if they were a
setting specific to the user or transient, rather than a document setting). This
will play nicer with version control systems.

See the discussion, e.g.:
http://thread.gmane.org/gmane.editors.lyx.devel/157824/focus=157993 (third
solution mentioned)

TODO:
* The interface remains to be set up. We cannot change this setting from LyX
  for now.
* If save_transient_properties is false, we should read the user setting as a
  per-user-per-document (session) setting (e.g. like the cursor position).
* Once the above is done, we can treat \justification the same way (but it would
  be even better if \justification was moved to lyxrc).
2016-01-12 21:25:34 +00:00
Guillaume Munch
f475795b92 Revert "Work around bug #9841"
This reverts commit dc016de34e.

See discussion at http://mid.gmane.org/n53ar8$1tj$1@ger.gmane.org
2016-01-12 21:25:34 +00:00
Enrico Forestieri
71ff50b753 Make sure the origin tag is properly terminated. 2016-01-10 23:17:59 +01:00
Günter Milde
3a70340a95 Use polyglossia also with DVI (LuaTeX).
Simplify the logic for language package selection and make it more consistent:

Use polyglossia with non-TeX fonts (system fonts/Unicode fonts) for all
export flavours (XeTeX, LuaTeX, DVI-LuaTeX), if the language package setting
is "auto" and there is no language not supported by Babel and no package
providing Babel.

This solves some Babel-related autotest cases and leads to some new failures
due to the polyglossia language nesting problem.
2016-01-08 22:52:28 +01:00
Georg Baum
5e3165e9cc Improve directory name juggling
The old code did not ensure that the path was only broken into parts at
directory separators. The new code ensures it.
2015-12-19 16:49:52 +01:00
Guillaume Munch
dc016de34e Work around bug #9841
\output_changes is now output at a distance from \tracking_changes.

Since both parameters can be seen as per-user preferences, they can cause
undesirable merge conflicts, in a multi-author setting, were it treated as a
single block by the version control system, as was the case before this patch.
2015-12-17 20:40:54 +00:00
Kornel Benko
f7a8c5b4eb \origin handling. Use realPath() intead of absFileName()
This change avoids misinterpreting paths containing symbolic parts.
Without this, lyx may not find its own sysdir.
2015-12-13 12:25:32 +01:00
Guillaume Munch
86bd1cd641 Fix bug #9854 "Dataloss after git merge with change tracking"
A plausible scenario is that change tracking is used together with a versioning
system. In this case, parallel modifications might remove an \author line on one
side, and add another change of this author on the other side. This scenario
causes a bad merge after which the added change has no associated author. In
this case, LyX used to display a list of errors on opening and deliberately
removed the corresponding change tracking information.

* If ever a tracked change refers to an author that does not exist, then add a
  dummy author. This dummy author is not saved to the file afterwards.

* Have a very clear error message on opening such a corrupt file.
2015-11-18 02:50:25 +00:00
Günter Milde
8021c0b0dc Update comments after solving #9740. 2015-11-13 13:59:17 +01:00
Günter Milde
0eb9477be7 Fix 480937a103708a651/lyxgit, second attempt.
Prevent encoding changes whenever the TeX engine is XeTeX or LuaTeX,
as XeTeX/LuaTeX use only one encoding per document:

* with useNonTeXFonts: "utf8plain",
* with XeTeX and TeX fonts: "ascii" (inputenc fails),
* with LuaTeX and TeX fonts: only one encoding accepted by luainputenc.

+1 no needless encoding switches
+1 runparams.encoding matches the correct encoding at any time
+1 less complicated code.

-1 there may still be problems with CJK (possibly impossible to
   solve for Xe/LuaTeX with TeX fonts).

For LuaTeX & TeX fonts, the complete document uses the encoding
of the global document language.

See also #9740.
2015-11-12 16:55:04 +01:00
Günter Milde
9894e0be23 Fix 480937a103708a651/lyxgit. See also #9740.
Actually, the changed tests were used to prevent overwriting the encoding
changed in Buffer::writeLaTeX with a language-default encoding.
This is still required for XeTeX with TeX-fonts unless a proper solution is found.

Documents with more than one encoding and TeX-fonts fail with LuaTeX,
as "luainputenc" can only handle one encoding.
2015-11-11 00:11:06 +01:00
Georg Baum
1d3a85fe37 Fix regression of 2fc430d5ae
Thanks Kornel for noticing
2015-11-09 20:06:36 +01:00
Georg Baum
2fc430d5ae Store both sets of font selections
This is one part of bug 9744: If you toggle between TeX fonts and non-TeX
fonts, the settings of the other choice are no longer thrown away, but stored
and re-activated if you switch back. Most parts of the patch are purely
mechanical (duplicating some BufferParams members), the only non-mechanical
change is in the GUI logic.
2015-11-09 07:36:42 +01:00
Richard Heck
ba99ea5b88 The cite engine info is needed by makeDocumentClass().
Fixes both #9797 and #9848.
2015-11-06 15:53:45 -05:00
Günter Milde
1523fc6023 Partial fix for #9740 "XeTeX/LuaTeX with TeX fonts problems".
Fixes output for 3 of the 4 test lyx-files.

Includes "FIXME"s at places where further action is required to get the XeTeX
export right but I don't know how.
2015-10-20 19:16:25 +02:00
Enrico Forestieri
435c1bbac7 Quote argument of tag when necessary
Both \origin and \textclass tags may be paths and contain spaces.
In this case, enclose them in double quotes such that they can be
correctly read by the lexer.
2015-08-15 18:32:41 +02:00
Juergen Spitzmueller
d722f5ed8e Properly pass char to stream (probably fix bug #9632) 2015-06-17 10:22:46 +02:00
Juergen Spitzmueller
4c0e99ac3d Check for, and report, uncodable characters in user preamble.
Fixes: #9599
2015-06-15 21:08:40 +02:00
Juergen Spitzmueller
edd37de8b4 Enable polyglossia for LuaTeX 2015-05-27 14:40:04 +02:00
Enrico Forestieri
806cfc5a8b Virtualize the origin tag for the system directory.
The documents saved to the system directory have now the origin tag
prefix "/systemlyxdir/". This allows both saving them always using
the same virtual path irrespective of the real path and to let the
origin tag work out of the box also on MacOS.
2015-05-26 00:29:46 +02:00
Enrico Forestieri
260a98d295 Save the document directory path only if explicitly allowed.
A new preference is introduced for allowing the record of the document
directory path in the saved file. Without explicit consent, it is not saved.
If the origin tag contains an invalid/wrong path or garbage, LyX behaves
exactly as before, i.e., included files are simply not found.
2015-05-23 17:49:33 +02:00
Georg Baum
84cca2dd94 Fix indentation 2015-05-17 17:27:27 +02:00
Enrico Forestieri
62d36bf04d Correctly load documents moved elsewhere after save.
It is now possible opening documents that where manually moved to a
different location after they were saved and still produce an output.
Indeed, (hopefully) all needed included files are now still found.
When the moved document is saved again, all paths are accordingly updated.
Of course, for this to work, a document has to be saved in Format 490,
at least.

As an example, after converting the user guide to the last format, it can
be copied anywhere and opened without the need of adapting the paths of
included files or moving them to a proper place.

There is one glitch I am aware of. When moving a child document (but not
the master) the path to the master is correctly updated but it won't be
recognized as such. This is because LyX checks that the parent actually
includes this document but, of course, being the parent document not
touched, it appears not including this child. Anyway, it will also occur
when saving the child to a different location and the user is warned
on the terminal about this fact when the moved child is loaded.
However, there is no problem when it is the master that has been moved.
2015-05-16 19:52:39 +02:00
Enrico Forestieri
306b136cc0 Fix bug #4812 (Layout in local directory lost on Save As, Copying)
The "save-as" part of the bug is fixed by extending the \textclass tag
such that, if a local layout file is used, its path relative to the
document directory is now stored together with the name. If a relative
path cannot be used, an absolute one is used but, in this case, the
document is not usable on a different platform.

The "copy" part is fixed by introducing a new \origin tag, which is
written when the file is saved. This tag stores the absolute path of
the document directory. If the document is manually copied to a
different location, the local layout file is retrivied by using
\origin (which is only updated on save).
This new tag may prove useful also for locating other files when the
document is manually moved to a different directory.

As in the original implementation the files needed for the layout
(for example, a latex class) had to be in the same directory as the
layout file, this directory has also to be added to TEXINPUTS.
2015-05-13 22:02:13 +02:00
Juergen Spitzmueller
5fec78f69f Properly determine active font encoding 2015-04-02 17:13:45 +02:00
Juergen Spitzmueller
7aad787047 fixltx2e must be loaded as early as possible
Fixes: #9452, #9361

This reverts the 'fix' to #7233, which must be solved differently.
2015-03-17 10:24:33 +01:00
Juergen Spitzmueller
af4090bb0a Make the missing class warning opt-out 2015-03-16 20:34:32 +01:00
Juergen Spitzmueller
f305f0b4d8 Properly handle the bicaption package (bug #9449) 2015-03-16 20:31:38 +01:00
Juergen Spitzmueller
d9626ec6af Set the logic straight 2015-03-15 10:38:37 +01:00
Juergen Spitzmueller
d15388ba98 Allow to disable inputenc loading via 'Provides inputenc 1' 2015-03-15 10:29:07 +01:00