Ask Your Question
2

Sagetex : hyphen in filename forbidden ?

asked 2015-01-28 14:43:55 +0100

laug gravatar image

updated 2023-01-10 00:01:09 +0100

tmonteil gravatar image

I want to cross-compile (pdflatex + sage + pdflatex) a TeX file : it's ok with the filename "a-b.tex", but not for a-n.tex, where i get the error message

CRITICAL:root:unknown notebook: None Error, notebook must be one of default, ipython, sagenb but got None

It seems that the problem is with the "-n" part of a-n.tex

it's a bug or a feature ? lg

macosX 10.10.1 + sage 6.4.1

edit retag flag offensive close merge delete

Comments

That is really interesting; -n is what launches the notebook. What are the names of the particular Sage files generated? That is what Sage runs on.

kcrisman gravatar imagekcrisman ( 2015-01-28 16:22:15 +0100 )edit

I confirm that: I copied sagetex's example file "example.tex" with the name "a-n.tex", ran "pdflatex a-n.tex", then "sage a-n.sagetex.sage" and Sage gives the same error message.

slelievre gravatar imageslelievre ( 2015-01-28 16:57:43 +0100 )edit

1 Answer

Sort by ยป oldest newest most voted
2

answered 2015-01-28 17:04:29 +0100

tmonteil gravatar image

updated 2015-01-28 18:08:16 +0100

This is a bug, thanks for reporting. On the file src/bin/sage, there is a condition:

if [[ "$1" =~ "--notebook="* || "$1" =~ "-n="* || "$1" =~ "-notebook="* ]]; then
    sage-cleaner &>/dev/null &
    exec sage-notebook "$@"
fi

The problem is that it is accepted if -n is part of the variable $1, not only a prefix, as you can check with:

$ A='aze-naze'
$ if [[ "$A" =~ "-n="* ]] ; then echo hop ; fi
hop

A better solution would be to add a ^ to specify the beginning of the string and use .* instead of *:

$ A='aze-n=aze'
$ if [[ $A =~ ^-n=.* ]] ; then echo hop ; fi

$ A='-naze'
$ if [[ $A =~ ^-n=.* ]] ; then echo hop ; fi

$ A='-n=aze'
$ if [[ $A =~ ^-n=.* ]] ; then echo hop ; fi
hop

It is reported as trac ticket 17685.

edit flag offensive delete link more

Comments

And the fix will be in Sage 6.5!

kcrisman gravatar imagekcrisman ( 2015-01-29 18:26:45 +0100 )edit

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Question Tools

Stats

Asked: 2015-01-28 14:43:55 +0100

Seen: 698 times

Last updated: Jan 28 '15