Commit graph

31 commits

Author SHA1 Message Date
Ori Livneh b71e60a5e1 Document command-line arguments for texvc
Change-Id: I7dc2597100835f04e617799c20e597bcff45d1f4
2016-03-10 15:14:03 -08:00
Ed Sanders 0f2fd944af Begining -> beginning
Change-Id: I91974126a3ea13e12c2a935d9d24e97e92b6df7e
2015-12-11 18:37:10 +00:00
C. Scott Ananian 209f3218ad Regularize spacing in texvc and texvccheck
Tweak the position of spaces between function invocations and arguments
so that the expansion of mediawiki-specific functions (`\Rho`, etc) is
consistent with how spacing is added to normal function invocations.

This helps ensure that `texvc`/`texvccheck` is idempotent -- that is,
that it can parse what it emits, and render it without change.

Change-Id: I05fc8fa0201debf611ed4900d3cc953a6a8188ac
2014-10-12 22:04:41 +02:00
C. Scott Ananian e38a70ef9e Some commands should require arguments in texvc and texvccheck
The \overbrace, \overleftarrow, \overleftrightarrow, \overline,
\overrightarrow, \underbrace, \underline, \widehat, and \widetilde
commands take a single mandatory argument.  Move \overbrace and
\underbrace to the fun_ar1nb list, since they handle trailing
subscripts and superscripts specially.  Move the other functions to
the fun_ar1 list.

Change-Id: I449c8611eeb2eaa7ccb30d3b325975868a160f95
2014-10-12 21:31:36 +02:00
C. Scott Ananian 9d0ed80bf9 Remove unused empty production for litsq_zq in texvc
It is impossible to take the empty alternative for this production,
since any input which matches `litsq_aq` would instead match `lit_aq`
if the empty alternative is used.  In addition, there is no action
clause for the empty alternative, so it wouldn't typecheck if the
empty alternative was possible.

This has no effect on the generated parser, but clarifies the grammar.
This commit matches a25078ff9d to
texvccheck.

Change-Id: I52eddd7321bd8450b47a5d57f2d704f0dd669f16
2014-10-12 19:28:03 +00:00
C. Scott Ananian b8161615f4 Switch to text mode before emitting \AA or \textvisiblespace.
The \AA and \textvisible space commands aren't valid in math mode.
Surround them with \mbox so that we switch to text mode before
emitting them.

Change-Id: I36c23c80751401be4bbce6aca6c3333912f67add
2014-10-12 21:18:25 +02:00
physikerwelt 636f96d3bb Remove $wgUseTeX
$wgUseTeX is not needed in the extension. For backwards compatibility,
it's also set in /mediawiki/includes/DefaultSettings.php and used in
/mediawiki/includes/EditPage.php only.

Change-Id: Ie5bcabf9e2e7474a4d41d1efcc5072c144640388
2014-01-26 00:07:16 +00:00
Reedy 40ba7ff462 Fix comment about Math compnent to report bugs etc
There isn't a texvc component in extensions

Change-Id: I7d868a37142be0d4163ff891f7392887643ead26
2013-09-20 09:13:18 +00:00
Physikerwelt 926db7c3bd Restructuring Math classes
The Math.body file which contains the MathRender class was split in the following way:
- Math.base contains the base class with the database related stuff and provides an abstract interface
- Math.source and Math.MathJax handle the plain tex string output. There are two classes since they
  will differntiate in the future I think.
- Math.texvc contains the "old" implementation of png generation with all the file handling related stuff
- Other implementation of math renderer can be added in the same style.
- Cleanup to better follow coding conventions.
- Changed LockManager to 'fsLockManager'

The first attempt restructure the class layout and introduce LaTeXML at the same
time was dropped. Instead this was split up into two phases.
This commit only deals about the restructuring of the math module design.

Change-Id: I9b1d68c4faa8d177d8d0088fa1a5879caed4f1fe
2013-02-07 20:35:45 -08:00
Derk-Jan Hartman 159708754c Adding some gitignore to the math directory, to ignore the compiled binaries and intermediary objects.
Change-Id: Ifcab01b5a67a8da65f8522cc00f2ae00e74a915a
2012-03-25 21:13:52 +02:00
Mark A. Hershberger 4165ebdfaa fix Bug 33739 - \text{äöü} doesn't add encoding preamble 2012-01-19 17:15:47 +00:00
Antoine Musso 040710a2f9 missing TEX_FUN1nb in html_render_deep()
The new TEX_FUN1nb introduced by r99741 was not added to the
html_render_deep() pattern matching list. This was spotted by
an ocaml compilation warning:

 File "html.ml", line 74, characters 31-2966:
 Warning 8: this pattern-matching is not exhaustive.
 Here is an example of a value that is not matched:
 TEX_FUN1nb (_, _)::_
2011-11-15 17:26:28 +00:00
Nicholas Longo a2b53e5a36 The following patches restore how texvc added braces for all commands
but \operatorname to fix Bug 31442.  More specifically, TEX_FUN1 now
adds braces as it did in previous versions.  The result is texvc will
once again correctly sanitize multiple math accents even when no braces are
given (e.g. \dot \vec B) and it will allow math accents to be used with
symbols whose font as been changed (e.g. \tilde \mathcal{M}).  Parser
tests are created to ensure these continue to work.  

The handling of \operatorname is now  handled specially by the
function TEX_FUN1nb (nb stands for no braces and the name is taken to
be consistent with the existing function TEX_FUN2nb).  The addition of
braces causes this command to LaTeX incorrectly.  The parser test for
\operatorname has been updated to reflect the fact the hash of the
images involved has changed.
2011-10-13 23:04:41 +00:00
Brion Vibber 77bbd35329 * (bug 6722) Spacing fixes for math functions with/without parens
* (bug 18912) Add math support for \sen Spanish variant of \sin
* (bug 18912) Fix spacing for \operatorname in math

Reapplies r86962, r87117, r87936, r87941 plus some parser tests.

Note that further batch testing to identify any other potential problems due to the spacing tweaks is a good idea!
2011-09-14 00:49:16 +00:00
Brion Vibber d2cf3c244b * (bug 19547): Apostrophe / single quotes in math \text{...}
Reapplied r87092 (tests added, tweaked for merge, no functional diff) to allow "'" and "`" in \text{...} bits.
I'm not convinced this is a sufficient fix -- there are probably a *lot* more where this came from.
But it doesn't hurt to add them!
2011-09-13 22:24:27 +00:00
Brion Vibber 8d495dcc32 * (bug 27754) Archaic Greek letters for math
May require texlive-lang-greek package to be installed; but it's only loaded when these bits are used.
Reapplied r87298 plus parser test case to confirm the new chars can render and the existing \digamma hasn't changed.
2011-09-13 22:14:01 +00:00
Brion Vibber dd490761b5 * (bug 27324) \euro support for <math>
Reapplied r87284 with a tweak to allow \euro through to conservative HTML output.
Parser test case added to confirm that \euro is HTMLable and the other euro variants are renderable to images.

This commit also includes tweaks to HTMLification of \phi, \varphi, and \varepsilon (conservative HTML) and changes the non-conservative HTMLification of number sets from plain letters to the dedicated Unicode chars for their symbols. These changes are not included in tests, but don't alter what input is supported.
2011-09-13 21:48:07 +00:00
Brion Vibber ae124a1e73 * (bug 26380) Add support for \widetilde to <math>
Reapplied r86965 (patch by Thenub314), plus parser test case to ensure that \widetilde{x} actually renders. (While we can't compare the contents of the image, the output hash will remain stable in the img url. Forcing $wgMathPath to a fixed fake path for parsertests.
2011-09-13 21:02:50 +00:00
Brion Vibber b76538b6b0 Revert changes to texvc that provide no test cases or examples of what they're fixing: r86962, r86965, r87092, r87117, r87284, r87298, r87934, r87936, r87941, r88030, r88260
While these mostly look like they seem to do what they claim, *none* of them provide any test cases.
Most don't even include an example in the commit messages.
2011-09-13 19:00:51 +00:00
Nicholas Longo 7346759250 The following change fixes minor issues with the MathML display of
arithmetic operations.  In particular in displaying x-2 it should use
the entity &minus; in MathML as well.  Also changed spacing so an
opporation such as "+" would render as <mo> + </mo> instead of
<mo>+</mo>.
2011-05-16 19:25:46 +00:00
Nicholas Longo a7dc3ef012 Removed the &ApplyFunction; MathML entity. This entity doesn't
survive sanitizing.  It can be rendered by the corresponding unicode
character, but this doesn't display correctly without the proper fonts
installed.
2011-05-14 03:04:08 +00:00
Nicholas Longo e9f24f5264 A change to fix a bug in LaTeX rendering of function names. An
additional space was necessary in the LaTeX code when rendering
functions such as \sin foo32.  Also a few lines of code were removed
from texutil.ml that are now handled by lexer.mll.
2011-05-13 00:01:44 +00:00
Nicholas Longo 0a98d44540 Corrects a small bug causing <math>\sin</math> to return an unknown
function error
2011-05-12 22:29:32 +00:00
Nicholas Longo c60fa06a6a This updates improves the MathML support of texvc. New new tags have
been added, but the parser now recognizes numbers containing decimal
points as being renderable using <mn>. The delimiters (,[,{ now render
using <mo> tags, this allows for equations such as "y=f(x)" to be
rendered to MathML.  Finally for standard functions such as \sin, now
render as <mi>\sin</mi>&ApplyFunction;, etc so standard function names
are supported.
2011-05-12 21:46:18 +00:00
Nicholas Longo 37300525a9 This update provides the functionality requested in bug 27754. More
specifically it provides the archaic greek letters defined in the
teubner package.  WARNING: This package requires the greek language
bable package, which on some linux systems is installed separately
from LaTeX.  As a result, texvc doesn't try to load this package
unless one of the archaic greek letters is being used.  This ensures
that the new commands do not prevent any of the old functionality from
operating as it did before.  

The following new commands are recognized. includes \Coppa, \coppa,
\varcoppa (synonym for \coppa), \Digamma, \Koppa (synonym for \Coppa),
\koppa, \Sampi, \sampi, \Stigma, \stigma, and \varstigma.

For more information see the comprehensive symbols table 280.  Note
that this update doesn't effect the current functionality of \digamma.
2011-05-02 21:13:45 +00:00
Nicholas Longo f095606895 This update fixes bug 27324 by loading the eurosym package to provide
the euro symbol.  This requires the eurosym package be available in
the installed LaTeX distribution.  Five new commands are now
recognized by texvc: \euro, \geneuro, \geneuronarrow, \geneurowide,
and \officialeuro.  All provide varients of the euro symbol, and \euro
is simply short alias for \officialeuro.  In addition some minor
changes have been introduced the html rendering of some math symbols.
The new choices provide html symbols that are higher degree of
similarity in comparison to the corresponding LaTeX symbols.
2011-05-02 19:28:25 +00:00
Nicholas Longo 250031caa2 This update removes unneeded code from texutil.ml and corrects the way
functions are handled in lexer.mll.  In particular lexer.mll failed to
insert a space that, in some cases rendering errors. This bug has now
been corrected.
2011-04-29 06:08:48 +00:00
Nicholas Longo 3dde4ef091 The following fixes bug 19547 by allowing left and right single
quotation symbols in the list of allowable characters in a textbox or mbox.
2011-04-28 18:23:23 +00:00
Nicholas Longo 924b4cf9dd This change adds support for the \widetilde command as mentioned in bug 26380 2011-04-26 18:44:22 +00:00
Nicholas Longo dbe0a339de The following changes enhance the way texvc handles space around
mathematical function names when translating to HTML; adds support for
the sen, the Spanish name for sin; and corrects a bug that eliminates
spacing around \operatorname{...} in the resulting png.  More
specifically, texvc now dectect whether or not a
standard function such as is followed by a delimitier such as (, {, [
etc. and adds a space or not as appropriate.  This issue  The code has been
reorganized to include a list of standard LaTeX commands whose spacing
rules are the same, and treates them all on an equal footing.  It
similarly treats functions defined for mediawiki in the same way it
treats standard latex functions. One addition function is added, \sen,
and others can be added easily if necessary.  Finally LaTeX generated
by texvc contained to many braces which altered the spacing created by
the command \operatorname, this has now been corrected.  These last
two changes address the issues raised in bug 18912 and the chaning in
translation to HTML address most, but not all, of the issues raised in
bug 6722 .
2011-04-26 18:17:23 +00:00
Brion Vibber c4d9349786 Initial stab at breaking math/texvc out to Math extension.
* (bug 14202) $wgUseTeX has been superseded by the Math extension. To re-enable
  math conversion after upgrading, obtain the Math extension from SVN or from
  http://www.mediawiki.org/wiki/Extension:Math and add to LocalSettings.php:
  require_once "$IP/extensions/Math/Math.php";

This is an initial stab, and a few things remain to be cleaned up:
* messages need to be moved from core to extension
* MW_MATH_* constants should be moved to the extension from core
* old back-compat math names interfaces using those constants should be removed from message files
* classic edit toolbar's math button should be added from the extension (or else dropped) -- currently there's not a clean hook, but could do it by JS
* couple of things like the 'armourMath' function on Language & LanguageConverter may want to be redone just as an unconditional, if that's simpler.

Setting $wgUseTeX alone will no longer have any affect. The var's still there for the moment as a few bits still need to be fully moved out from core.
2011-04-09 00:39:40 +00:00