Asked
Active
Viewed 791 times
3
JLDiaz
- 55,732
-
3What do you have so far? Right now, this is just a do-it-all-for-me and I think ought not be answered. That doesn't mean nobody will answer it. It doesn't even mean I won't, although it isn't an especially interesting question, so probably not if I have to start from scratch. – cfr Aug 07 '16 at 00:12
-
If you plan to create drawings for your thesis, you must, of course, plan to master relevant aspects of the tools you plan to use. If you have decided on TikZ, start with the tutorials at the beginning of the manual or follow-up the links to resources which were provided in comments on your earlier question. – cfr Aug 07 '16 at 00:14
-
Helpful manual for TikZ; I am just starting out with LaTeX and TikZ as well and I found that manual and this one very useful (the second is a LaTeX book). – auden Aug 07 '16 at 00:21
-
@cfr, you have much more experience than I do. I have created a starter answer, but I am having trouble getting the filling to fill every spot I want it too but none of the spots I don't want it too...do you know how I would fix the problem? (I know, this is ironic...I'm asking a question about a question.) – auden Aug 07 '16 at 01:27
-
1@heather Sorry, I don't think my comment was much use so I've posted an answer. I can delete it later if you want. – cfr Aug 07 '16 at 01:59
-
@cfr, no, your answer is great! Man, I can't believe I didn't find that. Thanks! – auden Aug 07 '16 at 12:55
2 Answers
5
I'm only answering this question because heather asked my advise and I cannot do this easily in a comment.
I would use a clipping for the fill. The idea is to clip to a wider rectangle with a semicircular bite out of the end and then fill a narrower rectangle without the bite.
\begin{scope}
\clip (-1,0) coordinate (a) |- (1,4) coordinate (b) -- (b |- a) arc (0:180:1);
\fill [pattern=north west lines] (-.5,0) coordinate (p) rectangle (.5,4) coordinate (q);
\end{scope}
The scope limits the effect of the clipping. This produces something like
Complete code:
\documentclass[border=10pt,multi,tikz]{standalone}
\usetikzlibrary{patterns}
\begin{document}
\begin{tikzpicture}
\begin{scope}
\clip (-1,0) coordinate (a) |- (1,4) coordinate (b) -- (b |- a) arc (0:180:1);
\fill [pattern=north west lines] (-.5,0) coordinate (p) rectangle (.5,4) coordinate (q);
\end{scope}
\draw (-2,0) -- (2,0);
\foreach \i [count=\j] in {-1,-1/2,0,1/2,1}
{
\draw (\i,0) coordinate (x\j) edge ++(0,2pt) -- ++(0,-2pt) node [below=5pt, anchor=mid, font=\scriptsize] {\i};
}
\draw [densely dashed] (a) arc (180:0:1) (p) -- (p |- q) (q) -- (q |- p);
\node [fill=white] at (0,2.5) {$F_1$};
\end{tikzpicture}
cfr
- 198,882
2
Here's a start:
\documentclass{article}
\usepackage[utf8]{inputenc}
\usepackage{tikz}
\usetikzlibrary{shapes.multipart}
\usetikzlibrary{positioning}
\usetikzlibrary{patterns}
\begin{document}
\centerline{\begin{tikzpicture}[scale=3]
\draw[dashed] (-1/2,0) -- (-1/2, 4);
\draw[dashed] (1/2,4) -- (1/2,0);
\begin{scope}
\clip (-1,0) coordinate (a) |- (1,4) coordinate (b) -- (b |- a) arc (0:180:1);
\fill [pattern=north east lines] (-.5,0) coordinate (p) rectangle (.5,4) coordinate (q);
\end{scope}
\draw (-1.25,0) -- (1.25,0);
\draw (-1, -.05) -- (-1, .05);
\draw (-1/2,-.05) -- (-1/2,.05);
\draw (0,-.05) -- (0,.05);
\draw (1/2,-.05) -- (1/2,.05);
\draw (1, -.05) -- (1, .05);
\draw (-1, -.3) node {-1};
\draw (-1/2, -.3) node {-1/2};
\draw (0, -.3) node {0};
\draw (1/2, -.3) node {1/2};
\node [fill=white] at (0,2.5) {$F_1$};
\draw (1, -.3) node {1};
\draw[dashed] (-1,0) .. controls (-1,0.555) and (-0.555,1) .. (0,1)
.. controls (0.555,1) and (1,0.555) .. (1,0);
\end{tikzpicture}}
\end{document}
I don't know if this is the most efficient way to do it, but it certainly works. The result is
Please note this is done on www.sharelatex.com
The north east line pattern shows up properly when downloaded as a pdf. Thanks to cfr for his awesome solution to the filling of the difficult portion of the rectangle and the box of no filling around the text.
auden
- 1,458
-
You can clip a filling. So you could construct a path from (-1,0) up to the top, across and down to (1,0) and then curve back to the start. Clip to that and then fill the rectangle (-1/2,0) to (1/2,5) and you should get the bit you want filled in, I think. You can either look in the patterns library for fillings or you can, I think, rotate it, but I'm not sure as patterns are a bit odd. – cfr Aug 07 '16 at 01:42


