Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
Jamal Bouajjaj
Cantor
Commits
5ced25ae
Commit
5ced25ae
authored
May 12, 2021
by
Jamal Bouajjaj
Browse files
Initial fix, need to finalize it
parent
85e59eb3
Pipeline
#61703
passed with stage
in 24 minutes and 24 seconds
Changes
3
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
src/backends/sage/sageexpression.cpp
View file @
5ced25ae
...
...
@@ -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
();
...
...
src/backends/sage/sageexpression.h
View file @
5ced25ae
...
...
@@ -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 */
src/backends/sage/sagesession.cpp
View file @
5ced25ae
...
...
@@ -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"
;
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment