1

This answer mentioned that the size of a node usually depends on the size of the content. For instance in following example the circle will have size 2cm as long as the content doesn't force it to make it bigger. Is it possible then to set the size of this circle to a fixed value that is independent of the size of the content? (So a too large content might possibly overflow.)

\begin{tikzpicture}
     \draw node[fill,circle,minimum size=2cm] {content};
\end{tikzpicture}
2
  • using a label with centering would overflow -- note that the text within braces is not used
    – js bibra
    Apr 22, 2021 at 9:39
  • 1
    @jsbibra ? It is used, it's just the same color of the fill. Try fill=yellow... BTW, nice trick for the answer!
    – Rmano
    Apr 22, 2021 at 10:01

1 Answer 1

3

enter image description here

\documentclass[tikz, border=10]{standalone}
\usepackage{tikz}
\begin{document}
    \begin{tikzpicture}
        
         \node[fill,circle,minimum size=2cm,label=center:\Huge content] {};
        
    \end{tikzpicture}
\end{document} 
4
  • 1
    Nice trick this one!
    – Rmano
    Apr 22, 2021 at 10:02
  • 1
    Thanks for the answer! So just to clarify, is it true that whenever I use the label=... instead of the {} to define the content, the node will be sized as if there was no content at all?
    – flawr
    Apr 22, 2021 at 10:05
  • 1
    @flawr -- this is not a new answer -- already answered here -- tex.stackexchange.com/a/414900/197451 --if you clarify the exact requirement probably a more detailed answer follows
    – js bibra
    Apr 22, 2021 at 10:09
  • I don't think I can add anything, this completely answers everything I wanted to know! thank you very much!
    – flawr
    Apr 22, 2021 at 11:12

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .