File tree Expand file tree Collapse file tree 2 files changed +12
-1
lines changed
Expand file tree Collapse file tree 2 files changed +12
-1
lines changed Original file line number Diff line number Diff line change 1313
1414add_numbered_vertex! (g) = (add_vertex! (g); top = nv (g)) # returns the number of the new vertex
1515
16+ # latex treats # as a special character, so we have to escape it. See:
17+ # https://github.com/sisl/TikzGraphs.jl/issues/12
18+ latex_escape (s:: String ) = replace (s, " #" , " \\ #" )
19+
1620" Convert the current node into a label"
1721function label (sym)
1822 sym == :(^ ) && return " \\ textasciicircum" # TikzGraphs chokes on ^
1923
20- return string (" \\ texttt{" , sym, " }" )
24+ return latex_escape ( string (" \\ texttt{" , sym, " }" ) )
2125end
2226
2327
Original file line number Diff line number Diff line change @@ -17,3 +17,10 @@ using Base.Test
1717 t = @tree x^ 2 + y^ 2
1818 @test length (t. labels) == 7
1919end
20+
21+ @testset " latex special characters" begin
22+ # Test for issues with the characters present in julia's generated symbols
23+ expr = Expr (Symbol (" ##271" ))
24+ t = walk_tree (expr)
25+ @test t. labels[1 ] == " \\ texttt{\\ #\\ #271}"
26+ end
You can’t perform that action at this time.
0 commit comments