0

I am trying to spread evenly in a line three floats (tikzpictures) with captions so they will have equal distances along the line: the first should be at far left the second exactly at the midpoint of the line and the third one at the far right of the line with no success. I didn't find anything that could help me in the floatrow manual (May I missed it). If someone can help I will appreciate it. I am open for new suggestions as floatrow package is somehow old (from 2009 with no updates). I tried the \makebox[s] but with no success with floats.

\documentclass[12pt]{exam}
\usepackage{calc}
\usepackage[a4paper, total={180mm,257mm},left=15mm,top=20mm,showframe]{geometry}
\usepackage[labelformat=empty,indention=0pt,justification=centering,singlelinecheck=no,textfont={normalsize}]{caption}
\usepackage{floatrow,tikz,amsmath}
\begin{document}
    \begin{figure}[h!]
        \begin{floatrow}[3]
            \ffigbox[\FBwidth]{
                \begin{tikzpicture}[scale=0.7]
                    \draw[thick] (0,0) circle (2);
                    \draw[fill=gray!50] (0,0) -- +(180:2) arc (180:108:2);
                    \foreach \x in {0,36,...,360} \draw[thick] (0,0) -- (\x:2);
            \end{tikzpicture}}{\caption{$\dfrac{1}{5}=\dfrac{\fbox{\phantom{\Large A}}}{\fbox{\phantom{\Large A}}}$}}
            
            \ffigbox[\FBwidth+\Xhsize/2]{
                \begin{tikzpicture}[scale=0.7]
                    \draw[fill=gray!50,step=0.75,line width=1pt] (0,1.5) grid (3,3.75) rectangle (0,1.5);
                    \draw[step=0.75, line width=1pt] (0,0) grid (3,1.5);
            \end{tikzpicture}}{\caption{$\dfrac{3}{5}=\dfrac{\fbox{\phantom{\Large A}}}{\fbox{\phantom{\Large A}}}$}}
            
            \ffigbox[\Xhsize]{
                \begin{tikzpicture}[scale=0.7]
                    \foreach \x in {0,1} \draw[thick, fill=gray!50] (\x,0) rectangle (\x+1,3);
                    \draw[thick] (2,0) rectangle (3,3);
                    \draw[thick] (0,1.5) -- (3,1.5);
            \end{tikzpicture}}{\caption{$\dfrac{2}{3}=\dfrac{\fbox{\phantom{\Large A}}}{\fbox{\phantom{\Large A}}}$}}
        \end{floatrow}
    \end{figure}
\end{document}

enter image description here

0

1 Answer 1

1

This uses \subfloat from the subcaption package. The spacing is provided by \hfill.

Technically, to put the center \subfloat in the exact center, one should put the left \subfloat inside \leavevmode\rlap{...} and the right \subfloat inside \llap{...}.

\documentclass[12pt]{exam}
\usepackage{calc}
\usepackage[a4paper, total={180mm,257mm},left=15mm,top=20mm,showframe]{geometry}
\usepackage[labelformat=empty,indention=0pt,justification=centering,singlelinecheck=no,textfont={normalsize}]{caption}
\usepackage{subcaption,tikz,amsmath}

\begin{document}
  \begin{figure}[h]
    \captionsetup[sub]{labelformat=empty}
    \subfloat[$\dfrac{1}{5}=\dfrac{\fbox{\phantom{\Large A}}}{\fbox{\phantom{\Large A}}}$]{%
      \begin{tikzpicture}[scale=0.7]%
        \draw[thick] (0,0) circle (2);
        \draw[fill=gray!50] (0,0) -- +(180:2) arc (180:108:2);
        \foreach \x in {0,36,...,360} \draw[thick] (0,0) -- (\x:2);
      \end{tikzpicture}}%
    \hfill
     \subfloat[$\dfrac{3}{5}=\dfrac{\fbox{\phantom{\Large A}}}{\fbox{\phantom{\Large A}}}$]{%
      \begin{tikzpicture}[scale=0.7]
        \draw[fill=gray!50,step=0.75,line width=1pt] (0,1.5) grid (3,3.75) rectangle (0,1.5);
        \draw[step=0.75, line width=1pt] (0,0) grid (3,1.5);
      \end{tikzpicture}}%
    \hfill
    \subfloat[$\dfrac{2}{3}=\dfrac{\fbox{\phantom{\Large A}}}{\fbox{\phantom{\Large A}}}$]{%
      \begin{tikzpicture}[scale=0.7]
        \foreach \x in {0,1} \draw[thick, fill=gray!50] (\x,0) rectangle (\x+1,3);
        \draw[thick] (2,0) rectangle (3,3);
        \draw[thick] (0,1.5) -- (3,1.5);
      \end{tikzpicture}}%
    \end{figure}
\end{document}

demo

You must log in to answer this question.

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