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 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 at 10:01
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 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 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 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 at 11:12

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.