Commit 5ced25ae authored by Jamal Bouajjaj's avatar Jamal Bouajjaj
Browse files

Initial fix, need to finalize it

parent 85e59eb3
Pipeline #61703 passed with stage
in 24 minutes and 24 seconds
......@@ -38,6 +38,10 @@ SageExpression::SageExpression( Cantor::Session* session, bool internal ) : Cant
{
}
void SageExpression::setLatexPrinting(bool is_latex_enabled){
m_isLatexPrint = is_latex_enabled;
}
void SageExpression::evaluate()
{
m_imagePath.clear();
......@@ -186,7 +190,7 @@ void SageExpression::evalFinished()
{
QString stripped=m_outputCache;
const bool isHtml=stripped.contains(QLatin1String("<html>"));
const bool isLatex=m_outputCache.contains(QLatin1String("\\newcommand{\\Bold}")); //Check if it's latex stuff
const bool isLatex=m_outputCache.contains(QLatin1String("\\newcommand{\\Bold}")) || m_isLatexPrint; //Check if it's latex stuff
if(isLatex) //It's latex stuff so encapsulate it into an eqnarray environment
{
int bol_command_len = QLatin1String("\\newcommand{\\Bold}[1]{\\mathbf{#1}}").size();
......
......@@ -39,6 +39,8 @@ class SageExpression : public Cantor::Expression
void onProcessError(const QString&);
void setLatexPrinting(bool is_latex_enabled);
public Q_SLOTS:
void evalFinished();
......@@ -51,6 +53,7 @@ class SageExpression : public Cantor::Expression
bool m_isHelpRequest;
int m_promptCount;
bool m_syntaxError;
bool m_isLatexPrint;
};
#endif /* _SAGEEXPRESSION_H */
......@@ -206,6 +206,7 @@ Cantor::Expression* SageSession::evaluateExpression(const QString& cmd, Cantor::
{
qDebug()<<"evaluating: "<<cmd;
SageExpression* expr=new SageExpression(this, internal);
expr->setLatexPrinting(m_sageVersion>=VersionInfo(9, 3) && Cantor::Session::isTypesettingEnabled());
expr->setFinishingBehavior(behave);
expr->setCommand(cmd);
expr->evaluate();
......@@ -397,6 +398,9 @@ void SageSession::runFirstExpression()
command=QLatin1String("help(")+command.left(command.size()-1)+QLatin1Char(')');
if(command.startsWith(QLatin1Char('?')))
command=QLatin1String("help(")+command.mid(1)+QLatin1Char(')');
if(m_sageVersion>=VersionInfo(9, 3) && Cantor::Session::isTypesettingEnabled()){
command=QLatin1String("latex(")+command.left(command.size())+QLatin1Char(')');
}
command.append(QLatin1String("\n\n"));
qDebug()<<"writing "<<command<<" to the process";
......
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