ASKSAGE: Sage Q&A Forum - Individual question feedhttps://ask.sagemath.org/questions/Q&A Forum for SageenCopyright Sage, 2010. Some rights reserved under creative commons license.Sat, 19 Sep 2015 16:53:02 -0500how to set latex options on graph to make them ultra small ?https://ask.sagemath.org/question/29488/how-to-set-latex-options-on-graph-to-make-them-ultra-small/I am currently playing with functions indexed by unlabeled graphs. The following method (belonging to my parent class which models linear combinations of graphs) tells my parent how to print basis element indexed by a graph m (m is in fact an integer vector modeling a graph up to isomorphism).
def _latex_term(self, m):
r"""
"""
G = m.to_graph()
opt = G.latex_options()
opt.set_option('tkz_style', 'Simple')
opt.set_option('vertex_labels', False)
opt.set_option('scale', 0.25)
opt.set_option('vertex_size', 0.0)
return '\mathcal{M}_{' + latex(G) + '}'
I tried to set the option 'vertex_size' to zero but the size of the vertex was not affected. I realize that some combinations of options can rapidly become incoherent. Currently, I do not manage to do smaller than in the copy-pasted proposition of code.
I just want a very small (but readable) unlabeled graph.Fri, 18 Sep 2015 12:06:18 -0500https://ask.sagemath.org/question/29488/how-to-set-latex-options-on-graph-to-make-them-ultra-small/Comment by nborie for <p>I am currently playing with functions indexed by unlabeled graphs. The following method (belonging to my parent class which models linear combinations of graphs) tells my parent how to print basis element indexed by a graph m (m is in fact an integer vector modeling a graph up to isomorphism).</p>
<pre><code> def _latex_term(self, m):
r"""
"""
G = m.to_graph()
opt = G.latex_options()
opt.set_option('tkz_style', 'Simple')
opt.set_option('vertex_labels', False)
opt.set_option('scale', 0.25)
opt.set_option('vertex_size', 0.0)
return '\mathcal{M}_{' + latex(G) + '}'
</code></pre>
<p>I tried to set the option 'vertex_size' to zero but the size of the vertex was not affected. I realize that some combinations of options can rapidly become incoherent. Currently, I do not manage to do smaller than in the copy-pasted proposition of code.</p>
<p>I just want a very small (but readable) unlabeled graph.</p>
https://ask.sagemath.org/question/29488/how-to-set-latex-options-on-graph-to-make-them-ultra-small/?comment=29489#post-id-29489I just upload an example [here](http://www-igm.univ-mlv.fr/~borie/vrac/graph_indexing_functions.pdf)
Precisely, I need to decrease the size of nodes. If I only decrease the scale, it produces some overlaps of the nodes.Fri, 18 Sep 2015 13:23:11 -0500https://ask.sagemath.org/question/29488/how-to-set-latex-options-on-graph-to-make-them-ultra-small/?comment=29489#post-id-29489Answer by fidbc for <p>I am currently playing with functions indexed by unlabeled graphs. The following method (belonging to my parent class which models linear combinations of graphs) tells my parent how to print basis element indexed by a graph m (m is in fact an integer vector modeling a graph up to isomorphism).</p>
<pre><code> def _latex_term(self, m):
r"""
"""
G = m.to_graph()
opt = G.latex_options()
opt.set_option('tkz_style', 'Simple')
opt.set_option('vertex_labels', False)
opt.set_option('scale', 0.25)
opt.set_option('vertex_size', 0.0)
return '\mathcal{M}_{' + latex(G) + '}'
</code></pre>
<p>I tried to set the option 'vertex_size' to zero but the size of the vertex was not affected. I realize that some combinations of options can rapidly become incoherent. Currently, I do not manage to do smaller than in the copy-pasted proposition of code.</p>
<p>I just want a very small (but readable) unlabeled graph.</p>
https://ask.sagemath.org/question/29488/how-to-set-latex-options-on-graph-to-make-them-ultra-small/?answer=29504#post-id-29504After checking the [documentation](http://doc.sagemath.org/html/en/reference/graphs/sage/graphs/graph_latex.html#sage.graphs.graph_latex.GraphLatex.set_option), under `vertex_size` there is a note about the `inner sep` parameter. It seems that this parameter cannot be accessed through sage, however you may be able to tweak it in the output by adding the following line to the LaTeX output:
\tikzset{VertexStyle/.style = {inner sep = 1pt}}
Right after the `\begin{tikzpicture}` would be a good place for this line. As a workaround, maybe searching and replacing the on the LaTeX string would be a way to "inject" this line to the output.
Hope this helps, otherwise please send some sample input to `_latex_term` for further assistance.Sat, 19 Sep 2015 16:53:02 -0500https://ask.sagemath.org/question/29488/how-to-set-latex-options-on-graph-to-make-them-ultra-small/?answer=29504#post-id-29504