0

I want to make a schematic of two masses connected by a string. One is positioned on a solid body, the other is hanging down the body's edge. Typically, a solid body is shown by putting diagonal lines within it. I could obviously just draw a couple ones with \draw, but maybe there is a faster way to do this.

If some of you know how this could be achieved, I'd be glad to learn how it's done.

MS-SPO
  • 11,519
  • 4
    Welcome. // The number and quality of answers to your question is a monotonic function of your code posted ;-) – MS-SPO May 24 '23 at 12:06
  • I don't have any code to display. I'm just wondering whether there is a way to easily achieve what I described in the question. – TeamPhysics May 24 '23 at 12:18
  • 3
    Please add a manual sketch. – Raffaele Santoro May 24 '23 at 12:57
  • 1
    I think what you are looking for is something like https://tikz.net/dynamics_friction/ or https://tex.stackexchange.com/q/518580/47927 where patterns are used. – Jasper Habicht May 24 '23 at 12:58
  • 4
    You could come up with some sketch and a minimal working example that shows what you want to draw (with or without the diagonal lines that you want to add). With this, we could show you how to add what you want. But without any code or picture, it is hard to guess what you're after. As I said, I would suggest loading the patterns library and add pattern=north east lines to the area you want to fill with this pattern. There is also the patterns.meta library that allows for finer adjustment (have a look at the TikZ manual). – Jasper Habicht May 24 '23 at 13:14

1 Answers1

1

I am unsure what you want to achieve exactly, but you could maybe make use of patterns:

\documentclass[border=10pt]{standalone}
\usepackage{tikz}
\usetikzlibrary{patterns}

\begin{document} \begin{tikzpicture}

\begin{scope}[shift={(-1.5,0)}] \fill[pattern=north east lines] (-1,0) rectangle (1,-0.25); \draw[thick] (-1,0) -- (1,0);

\fill (0,0.35) circle[radius=0.35];

\end{scope}

\begin{scope}[shift={(1.5,0)}] \fill[pattern=north east lines] (-1,0) rectangle (1,0.25); \draw[thick] (-1,0) -- (1,0);

\draw (0,0) -- (0,-1);
\fill (0,-1) circle[radius=0.35];

\end{scope}

\end{tikzpicture} \end{document}

enter image description here