1

Until now i have the following code:

\documentclass[tikz,border=10pt]{standalone}
\begin{document}

\tikzstyle{dim} = [latex-latex]

\begin{tikzpicture} \fill[blue!60!white] (0,0) rectangle (29,2); \fill[blue!60!white] (4,2) rectangle (5,25); \fill[blue!60!white] (8,2) rectangle (9,25); \fill[blue!60!white] (14,2) rectangle (15,25); \fill[blue!60!white] (18,2) rectangle (19,25); \fill[blue!60!white] (24,2) rectangle (25,25); \fill[blue!60!white] (28,2) rectangle (29,25);

\draw[black, ultra thick] (0,0) -- (29,0); \draw[black, ultra thick] (0,0) -- (0,2); \draw[black, ultra thick] (0,2) -- (4,2); \drawblack, ultra thick -- (4,25); \drawblack, ultra thick -- (5,25); \drawblack, ultra thick -- (5,2); \drawblack, ultra thick -- (8,2); \drawblack, ultra thick -- (8,25); \drawblack, ultra thick -- (9,25); \drawblack, ultra thick -- (9,2); \drawblack, ultra thick -- (14,2); \drawblack, ultra thick -- (14,25); \drawblack, ultra thick -- (15,25); \drawblack, ultra thick -- (15,2); \drawblack, ultra thick -- (18,2); \drawblack, ultra thick -- (18,25); \drawblack, ultra thick -- (19,25); \drawblack, ultra thick -- (19,2); \drawblack, ultra thick -- (24,2); \drawblack, ultra thick -- (24,25); \drawblack, ultra thick -- (25,25); \drawblack, ultra thick -- (25,2); \drawblack, ultra thick -- (28,2); \drawblack, ultra thick -- (28,25); \drawblack, ultra thick -- (29,25); \drawblack, ultra thick -- (29,0);

\fill[black!40!white] (6,3.5) rectangle (7,25); \fill[black!40!white] (16,3.5) rectangle (17,25); \fill[black!40!white] (26,3.5) rectangle (27,25); \draw[black, ultra thick] (6,3.5) rectangle (7,25); \draw[black, ultra thick] (16,3.5) rectangle (17,25); \draw[black, ultra thick] (26,3.5) rectangle (27,25);

\fill[red!60!white] (0,26.5) rectangle (29,28.5); \fill[red!60!white] (0,3.5) rectangle (1,26.5); \fill[red!60!white] (2,3.5) rectangle (3,26.5); \fill[red!60!white] (10,3.5) rectangle (11,26.5); \fill[red!60!white] (12,3.5) rectangle (13,26.5); \fill[red!60!white] (22,3.5) rectangle (23,26.5);

\drawblack, ultra thick -- (0,28.5); \drawblack, ultra thick -- (29,28.5); \drawblack, ultra thick -- (29,26.5); \drawblack, ultra thick -- (29,26.5); \drawblack, ultra thick -- (23,3.5); \drawblack, ultra thick -- (23,3.5); \drawblack, ultra thick -- (22,26.5); \drawblack, ultra thick -- (21,26.5); \drawblack, ultra thick -- (21,3.5); \drawblack, ultra thick -- (21,3.5); \drawblack, ultra thick -- (20,3.5); \drawblack, ultra thick -- (13,26.5); \drawblack, ultra thick -- (13,3.5); \drawblack, ultra thick -- (13,3.5); \drawblack, ultra thick -- (12,26.5); \drawblack, ultra thick -- (11,26.5); \drawblack, ultra thick -- (11,3.5); \drawblack, ultra thick -- (11,3.5); \drawblack, ultra thick -- (10,3.5); \drawblack, ultra thick -- (3,26.5); \drawblack, ultra thick -- (3,3.5); \drawblack, ultra thick -- (3,3.5); \drawblack, ultra thick -- (2,26.5); \drawblack, ultra thick -- (1,26.5); \drawblack, ultra thick -- (1,3.5); \drawblack, ultra thick -- (0,3.5);

\fill[red!60!white] (20,3.5) rectangle (21,26.5);

\draw[dim] (1.5,32) -- ++(12.5,32) node[midway,above] {$d_o$};

\end{tikzpicture} \end{document}

The \draw[dim] (1.5,32) -- ++(12.5,32) node[midway,above] {$d_o$}; command is from https://texample.net/tikz/examples/signpost/ but I don't understand it completely. I want to show the dimensions from the mid of the first red pair of fingers to the second pair of red fingers so that the double arrow is above the drawing and the marker lines show the distance. The caption should also be much larger.

How can I show the dimensions so that it looks like the d_o in the texample above?

Machzx
  • 119

1 Answers1

2

++ implies a relative coordinate from previous point. Therefore, with (1.5,32)--++(12.5,32), the pen which is on (1.5,32) moves to a new position which is (12.5,32) far from there while with (1.5,32)--(12.5,32) the pen moves from (1.5,32) to (12.5,32).

Package tikz-dimline was designed to show dimensions. You can use it or draw everything by hand.

Following code show a simpler version of your drawing. Instead of using color rectangles with a border line which is drawn by segments. The code show how to draw them like a filled and drawn closed path. Relative coordinates are used to draw perpendicular segments (-|, |-).

Original dimensions for the complete scheme are around 29x25 cm. I've scaled by 0.5 and used a Huge font.

\documentclass[tikz,border=10pt]{standalone}
\usepackage{tikz-dimline}
\begin{document}

\begin{tikzpicture}[scale=0.5] \draw[fill=blue!60!white] (0,0) -| ++(29,25) -| ++(-1,-23) -| ++(-3,23) -| ++(-1,-23) -| ++(-5,23) -| ++(-1,-23) -| ++(-3,23) -| ++(-1,-23) -| ++(-5,23) -| ++(-1,-23) -| ++(-3,23) -| ++(-1,-23) -| cycle;

\begin{scope}[yshift=3.5cm]

\draw[fill=black!40!white] (6,0) rectangle ++(1,21.5); \draw[fill=black!40!white] (16,0) rectangle ++(1,21.5); \draw[fill=black!40!white] (26,0) rectangle ++(1,21.5);

\draw[fill=red!60!white] (0,0) |- ++(29,25) |- ++(-6,-2) |- ++(-1,-23) |- ++(-1,23) |- ++(-1,-23) |- ++(-7,23) |- ++(-1,-23) |- ++(-1,23) |- ++(-1,-23) |- ++(-7,23) |- ++(-1,-23) |- ++(-1,23) |- cycle; \end{scope}

\dimline[label style={above, font=\Huge}] {(1.5,29)}{(11.5,29)}{$d_o$} \end{tikzpicture} \end{document}

enter image description here

Ignasi
  • 136,588
  • Hi, I have deleted my previous question and I have put this :-) https://tex.stackexchange.com/questions/566868/frame-created-with-tcolorbox-adding-the-white-holes thank you very much. – Sebastiano Oct 15 '20 at 11:52