Commit 8462dfe7 authored by Nikita Sirgienko's avatar Nikita Sirgienko
Browse files

[Sage] Enable latex typesettings again, because in new sage versions latex...

[Sage] Enable latex typesettings again, because in new sage versions latex support better, but also allow disable it in sage setting
parent e010d908
......@@ -61,8 +61,13 @@ Cantor::Session* SageBackend::createSession()
Cantor::Backend::Capabilities SageBackend::capabilities() const
//Disable Cantor::Backend::LaTexOutput, see sagesession.cpp:421
return Cantor::Backend::SyntaxHighlighting|Cantor::Backend::Completion;
Cantor::Backend::Capabilities caps = Cantor::Backend::SyntaxHighlighting|Cantor::Backend::Completion;
// Latex output from sage sometimes correct, sometimes not, so allow disable typesetting, if user want it
if (SageSettings::self()->allowLatex())
caps |= Cantor::Backend::LaTexOutput;
return caps;
bool SageBackend::requirementsFullfilled(QString* const reason) const
......@@ -10,6 +10,10 @@
<label>Path to the Sage executable</label>
<default code="true">QUrl::fromLocalFile(QStandardPaths::findExecutable( QLatin1String("sage") ))</default>
<entry name="allowLatex" type="Bool">
<label>Enable LaTeX typesetting for Sage backend</label>
<entry name="autorunScripts" type="StringList">
<label>List of scripts to autorun at the beginning of session</label>
......@@ -457,13 +457,9 @@ void SageSession::setTypesettingEnabled(bool enable)
// We have problems with Sage latex output (generates invalid code sometimes), so disable sage
// latex output until this not be solved. Users can enable sage latex by hands using %display
// sage magic.
//tell the sage server to enable/disable pretty_print
//const QString cmd=QLatin1String("__cantor_enable_typesetting(%1)");
//evaluateExpression(cmd.arg(enable ? QLatin1String("true"):QLatin1String("false")), Cantor::Expression::DeleteOnFinish);
const QString cmd=QLatin1String("__cantor_enable_typesetting(%1)");
evaluateExpression(cmd.arg(enable ? QLatin1String("true"):QLatin1String("false")), Cantor::Expression::DeleteOnFinish);
void SageSession::setWorksheetPath(const QString& path)
......@@ -39,6 +39,16 @@
<widget class="QCheckBox" name="kcfg_allowLatex">
<property name="toolTip">
<string>Sage LaTeX output not always correct, so latex typesetting can be disable for better experience</string>
<property name="text">
<string>Enable LaTeX typesetting</string>
<widget class="QGroupBox">
<property name="title">
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment