jkuczm / MathematicaCellsToTeX

Convert Mathematica cells to TeX, retaining formatting.
Other
57 stars 10 forks source link

Unsupported box exception for every input #24

Closed abusse closed 5 years ago

abusse commented 6 years ago

Hi,

I'm getting an unsupported box exception for every input no matter how simple it is. For example

CellToTeX[1, "Style" -> "Input"]

results in

CellsToTeXException::unsupported: Box: CellsToTeX`Private`AnnotateSyntax[1,Annotation->(CellsToTeX`Configuration`syntaxBox[#1,First[#2]]&),StringBoxToTypes->{SyntaxAnnotations`Private`str_/;SyntaxAnnotations`Private`$inFunction&&StringMatchQ[SyntaxAnnotations`Private`str,#*]:>{{PatternVariable,Function}},_?SyntaxAnnotations`Private`undefinedSymbolQ->{UndefinedSymbol},_String?SyntaxAnnotations`Private`symbolNameQ->{DefinedSymbol}},AnnotateComments->False] is not one of supported: {CellsToTeX`Configuration`syntaxBox[_,DefinedSymbol,___],CellsToTeX`Configuration`syntaxBox[_,UndefinedSymbol,___],CellsToTeX`Configuration`syntaxBox[_,LocalVariable,___],CellsToTeX`Configuration`syntaxBox[_,FunctionLocalVariable,___],CellsToTeX`Configuration`syntaxBox[_,PatternVariable,___],<<24>>,HoldPattern[UnderoverscriptBox[Repeated[_,{3}],OptionsPattern[]]],HoldPattern[FractionBox[Repeated[_,{2}],OptionsPattern[]]],HoldPattern[SqrtBox[Repeated[_,{1}],OptionsPattern[]]],HoldPattern[RadicalBox[Repeated[_,{2}],OptionsPattern[]]],_String}. Exception occurred in CellsToTeX`Configuration`boxesToTeXProcessor[{BoxRules->{CellsToTeX`Configuration`syntaxBox[CellsToTeX`Private`boxes$_,DefinedSymbol,___]:>\mmaDef{<>CellsToTeX`Configuration`makeString[CellsToTeX`Private`boxes$]<>},<<32>>,CellsToTeX`Private`str$_String:>StringReplace[CellsToTeX`Configuration`makeStringDefault[CellsToTeX`Private`str$],{Rule[<<2>>],Rule[<<2>>],Rule[<<2>>],Rule[<<2>>],Rule[<<2>>],Rule[<<2>>],Rule[<<2>>],RuleDelayed[<<2>>]}]},<<1>>,{Boxes->CellsToTeX`Private`AnnotateSyntax[1,Annotation->(CellsToTeX`Configuration`syntaxBox[<<2>>]&),StringBoxToTypes-><<1>>,AnnotateComments->False],<<3>>}}].

I read in another issue that, naturally, not all box types are supported, however as I'm not able to get even the simplest example working I'm guessing this is not the issue here. I have already tried several different inputs always resulting in an exception.

jkuczm commented 6 years ago

AnnotateSyntax is a symbol from dependency package SyntaxAnnotations`. The fact that CellsToTeX`Private`AnnotateSyntax appears in error message means that SyntaxAnnotations` was not properly loaded.

What code do you use to load CellsToTeX` package? Do you get any error messages when loading the package, like Get::noopen: Cannot open SyntaxAnnotations`., or Needs::nocont: Context SyntaxAnnotations` was not created when Needs was evaluated.?

abusse commented 6 years ago

I used Needs["CellsToTeX`"] to load the package and that does not give my any errors.

jkuczm commented 6 years ago

What does Names@"SyntaxAnnotations`*" output after evaluating Needs["CellsToTeX`"]?

abusse commented 6 years ago

The output is {"SyntaxAnnotations`AnnotateSyntax"}

jkuczm commented 6 years ago

Which version of Mathematica are you using? Do you get the same error if, on clean kernel, you load package directly from repository using:

Import["https://raw.githubusercontent.com/jkuczm/MathematicaCellsToTeX/master/NoInstall.m"]

Note that 1 is not a valid box, so even if everything works correctly you should still get unsupported box exception, but the reported invalid box should be 1 not CellsToTeX`Private`AnnotateSyntax[1,...

abusse commented 6 years ago

That works, thank you! I just used 1 as box as it seemed the simplest to me after trying more complex examples.

jkuczm commented 6 years ago

If package works when loaded directly from repository, then it seems that something went wrong with your local installation of package. Try reinstalling it.