TeX - LaTeX Asked by mi laborans on October 5, 2021
Xelatex, while processing graphviz code doubles the hashmark (#) char before the RGB color specification.
E.g. latex/graphviz code:
digraph [scale=1]{mygraph} {
node [color="#365559"]
a->b
}
Resulting mygraph.dot:
digraph mygraph {
node [color="##365559"]
a->b
}
How do I overcome this {bug/feature}, without touching the shell (e.g. sed)?
In the graphviz
package a macro is defined that has three arguments: the graph options, the name of the graph file and the contents. Within that macro the content of those arguments is written to a .dot
file using the write
command.
LaTeX tries to avoid that the #
character inside the contents of a macro argument is seen as an argument itself, therefore the character is doubled. It would be a bit more intuitive in the current use case if the #
was treated verbatim instead. However, you can define it as verbatim yourself with the newverbs
package (similar to https://tex.stackexchange.com/a/37757) and use that macro in the code for the graph.
MWE:
documentclass{article}
usepackage{newverbs}
usepackage{graphviz}
begin{document}
Verbdefmyhash{#}
digraph [scale=1]{mygraph} {
node [color="myhash FF0000"]
a->b
}
end{document}
Result:
Correct answer by Marijn on October 5, 2021
Get help from others!
Recent Answers
Recent Questions
© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP