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.
\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.
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.
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.
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.
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.
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.
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.
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.
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.
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.
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.
This is a patch I originally sent to lyx-devel in 2012 with subject
'Load footmisc.sty instead of using copied code from obsolete stblftnt.sty'.
It now takes all comments into account: It works also if the user loads the
package herself, it can be disabled by providing the footmisc feature in a
layout, and it does not use the ugly \AtBeginDocument{}.
Add display_pixel_ratio to buffer params to use it for displays with high resolution.
It holds the highest ratio between physical pixels and device-independent pixels of the LyX application.
Preview snippets will be generated using this value to get high resolution preview.
* 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
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.
Babel makes the character ':' active in french documents, and the listings
package cannot cope with that if it is loaded before babel. If it is loaded
after babel it works. This makes the french EmbeddedObjects manual compilable.
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.
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.
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?
Since a complete solution requires some refactoring, I fixed the bug for the
most important case: The main document language is only supported by
polyglossia. If any other language than the main one is only supported by
polyglossia the bug is still there.
We only need to sort the formats when it is really necessary, i.e. for GUI
purposes.
This also prevents 11000 requests for translation everytime the toolbars
are updated.
- Use the LyX name of encodings instead of the LaTeX names.
The LyX name must be unique, while the name used by LaTeX
not necessarily, e.g. different packages might implement
support for the same encoding.
- Rename koi8 to koi8-r, so that the LyX and LaTeX names match.
- Rename euc-jp-plain to euc-jp-platex, jis-plain to jis-platex
and shift-jis-plain to shift-jis-platex.
- Add utf8-platex encoding (fixes#8408).
LyX file format incremented to 463.
The fix is basically mechanical, the additional code for fraction like insets
with three arguments was stolen from \unitfrac. As any math package,
stackrel.sty needs a buffer parameter to switch it off.
I also added the two stackrel flavours to the toolbar.
The stmaryrd package adds support for lots of math symbols, using a font
designed to accompany the computer modern fonts. The changes in detail:
- Fix generate_symbols_list.py to work with stmaryrd.sty. It loooks like it
was automatically translated from a perl version and never used.
- Generate the new symbols in lib/symbols using generate_symbols_list.py and
add some manual adjustments
- Generate stmary10.ttf by a simple ttf export from stmary10.sfd with fontforge
- Add license info for stmary10.ttf
- Create a test file with all symbols from stmaryrd.sty. Actually it would be
nice to have this for the other fonts as well.
- The mechanics: lyx2lyx, tex2lyx, font machinery etc.
With non-TeX fonts, you can select a 'Non-TeX Font Default' math font, which simply loads unicode-math without actually selecting a math font, this then uses the default math otf font, currently Latin Modern. Other fonts still need to be set manually in the preamble, via \setmathfont.
The implementation suppresses unneeded package requests from unicodesymbols, but the output still uses macros instead of full unicode (both is possible with unicode-math).
The whole thing is a proof of concept, and it needs to be tested. I have tested it with the math manual, which compiles and seems to display correctly if I remove some hardcoded package loadings. OTOH I have not much experience with math.
This addresses #7449 partly.
This addresses #6543 by adding an option to prevent fonts such as Palatino and Times to automatically adapt the math font (IOW it lets you load the text font only for a bunch of fonts where this is easily possible).
Furthermore it adds an interface to select a specific math font, which is defined in latexfonts. Currently, this is only euler (the only one I know), but if there are other math-only tex fonts, they can be added easily (but note that this changes the file format).
Non-TeX math fonts are not yet supported. Eventually, unicode-math support can use the existing UI, but this is not on my agenda.
The LaTeX font information are now centralized and outsourced. This removes a lot of hardcoding and duplication and makes it easier to support new LaTeX fonts.
* Assure that really no language package is called when none is selected.
* Only call global custom package if global is desired.
This is a candidate for branch as well.
objects. The problem that led to the leak is that these objects can be held in
memory long after the Buffer that created them is gone, mostly due to their
use in the CutStack. So they were previously held in a storage facility, the
DocumentClassBundle. Unfortunately, they were now being created too often,
especially by cloning. It's not really a leak, because they're accessible, but
we weren't ever destroying them.
This new approach uses a shared_ptr instead.
Thanks to Vincent for pointing out const_pointer_cast.
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.
Add a new layout syntax CiteEngine to define the citation commands
available for a given citation engine.
Also extend the CiteFormat syntax to allow more customization. This
mechanism, previously used to produce bibliography entries in the
citation GUI based on the BibTeX entrytype, is now also used to
produce the textual labels for citation insets in the buffer view.
Thus citation styles are almost completely customizable by modules.
Modules for the basic, jurabib and natbib engines are implemented.
Layout format incremented to 37.
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@40820 a592a061-630c-0410-9148-cb99ea01b6c8
To avoid duplicity, remove natbib_authoryear and natbib_numerical
and replace them by natbib, and keep track of the engine `type'
in the new \cite_engine_type document setting. This will make it
easier to add more citation engines.
LyX format incremented to 424.
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@40592 a592a061-630c-0410-9148-cb99ea01b6c8
Internal machinery, no file format change and no UI change yet
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@40562 a592a061-630c-0410-9148-cb99ea01b6c8
This holds the name of a BibTeX style file for now. Any BibTeX inset
can set the style to "default" to use the document-wide style.
LyX format incremented to 420.
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@40484 a592a061-630c-0410-9148-cb99ea01b6c8
now) and move more packages to the new exclude mechanism.
The remaining ones are not so easy.
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@40442 a592a061-630c-0410-9148-cb99ea01b6c8