samcarter / tikzducks

A latex package to draw cute rubber ducks with TikZ
https://ctan.org/pkg/tikzducks
LaTeX Project Public License v1.3c
169 stars 13 forks source link

autoscale text #20

Open ghost opened 6 years ago

ghost commented 6 years ago

Maybe it would be convenient to automatically scale the text in book, speech, think to the available width

adding transform shape from https://github.com/samcarter8/tikzducks/commit/1a039d7bd3b2795f3853a93c7d101995e71e6a50 might be a starting point

VHarisop commented 6 years ago

What is the status of this? Until autoscaling is properly implemented, is there a way to resize speech/thought bubbles manually?

ghost commented 6 years ago

@VHarisop Thanks a lot for your comment! I'm still unsure what the best course of action is for the scaling of text. On the one hand site automatically scaling looks very convenient, on the other hand I'd like the user to have as many possibilities as possible to choose a suitable font size (which makes the text easier to read at small sizes than just scaling the normal sized text down) and yo apply other text formatting like parboxes or minipages for multiline text.

Here are a few suggestions for manual resizing of the text:

\documentclass{standalone}
\usepackage{tikzducks}

\begin{document}

\begin{tikzpicture}
    \duck[speech={Quack!}]
\end{tikzpicture}   

\begin{tikzpicture}
    \duck[speech={\tiny Quack!}]
\end{tikzpicture}   

\begin{tikzpicture}
    \duck[speech={\scalebox{0.5}{\tiny Quack! Quack! Quack!}}]
\end{tikzpicture}   

\begin{tikzpicture}
    \duck[speech={\scalebox{0.7}{\parbox{1.7cm}{\vspace*{-0.3cm}\flushleft \tiny Quack! Quack! Quack! Quack!}}}]
\end{tikzpicture}   

\end{document}

document

If these suggestions don't work for, please feel free to show a short example what you are trying to do and I'll try to come up with something.

ghost commented 6 years ago

@VHarisop FYI: your avatar inspired my to draw https://github.com/samcarter8/tikzzoo/blob/master/pingu.tex :)

VHarisop commented 6 years ago

@samcarter8 Thanks for the quick reply! I think I misspecified my problem: I'm preparing a presentation on beamer, so instead of making the text small I would rather make the speech bubble bigger, so that the text remains visible.

ghost commented 6 years ago

@VHarisop Oh, for this you could draw the bubbles yourself, they are basically just an ellipse


\documentclass{standalone}
\usepackage{tikzducks}

\begin{document}

\begin{tikzpicture}
    \duck[]
  \fill[gray!30!white] (-1.2,1.8) ellipse (1.4 and 0.5);
  \fill[gray!30!white] (-0.2,1.54) -- (0.2,1.35) -- (0.0,1.6) -- cycle;
    \node at (-1.2,1.8) {Quack! Quack!};
\end{tikzpicture}   

\end{document}

document

Or you could use the tikz shapes.callouts library:

\documentclass{standalone}
\usepackage{tikzducks}

\usetikzlibrary{shapes.callouts}

\begin{document}

\begin{tikzpicture}
    \duck
  \node[ellipse callout, draw,callout relative pointer={(0.5,-0.8)}] at (-0.5,2.5) {Quack! Quack!};
\end{tikzpicture}   

\end{document}

document