4

I want to align my tikz within a text.

A sample can be seen at the second picture in the following link: Image courtesy from http://www.echoecho.com/htmlimages08.htm enter image description here

This is my trial:

\documentclass{article}
\usepackage[utf8]{inputenc}
\usepackage[margin=6.0em]{geometry}
\usepackage[nomessages]{fp}
\usepackage{mathtools}
\usepackage{amssymb}
\usepackage{stmaryrd }
\usepackage{graphicx}
\usepackage{tikz}
\usepackage{wrapfig}
\usepackage{enumerate}
\usepackage[turkish]{babel}

\usepackage[hidelinks]{hyperref}
\usepackage[stable]{footmisc}
\usepackage{perpage} %the perpage package
\MakePerPage{footnote} %the perpage package command

\setcounter{secnumdepth}{-1}

 \begin{document}

\begin{enumerate}
\item 
Ardışık üç pozitif tamsayının çarpımının hiçbir zaman bir tamsayının birden büyük bir kuvvetine eşit olamayacağını gösteriniz.

\item

\begin{tabular}[t]{p{4.5cm}r}

$ABCD$ kirişler dörtgeni ve $|AE|=|AD|$, $|BC|=|BE|$ dir. 
Buna göre, $EF\parallel AB$ olduğunu gösteriniz.

&


\definecolor{ffffff}{rgb}{1,1,1}
\begin{tikzpicture}[baseline=(current bounding box.north),line cap=round,line join=round,>=triangle 45,x=0.24698133918770565cm,y=0.24577572964669714cm]
\clip(-0.5,-2.72) rectangle (11.5,3.6);
\draw [line width=1.2pt] (0.06,-2.01)-- (4.43,3.26);
\draw [line width=1.2pt] (9.33,1.94)-- (4.43,3.26);
\draw [line width=1.2pt] (9.33,1.94)-- (11.14,-2.13);
\draw [line width=1.2pt] (11.14,-2.13)-- (0.06,-2.01);
\draw [line width=1.2pt] (11.14,-2.13)-- (4.43,3.26);
\draw [line width=1.2pt] (9.33,1.94)-- (0.06,-2.01);
\draw (-0.38,-2.0) node[anchor=north west] {$A$};
\draw (11.4,-2.00) node[anchor=north west] {$B$};
\draw (9.56,2.14) node[anchor=north west] {$C$};
\draw (3.96,3.48) node[anchor=north west] {$D$};
\draw (6,0.92) node[anchor=north west] {$E$};
\draw (7.90,0.87) node[anchor=north west] {$F$};
\begin{scriptsize}
\fill [color=ffffff] (0.06,-2.01) circle (2.0pt);
\fill [color=ffffff] (4.43,3.26) circle (2.0pt);
\fill [color=ffffff] (9.33,1.94) circle (2.0pt);
\fill [color=ffffff] (11.14,-2.13) circle (2.0pt);
\fill [color=ffffff] (6.36,0.67) circle (2.0pt);
\fill [color=ffffff] (7.67,0.66) circle (2.0pt);
\end{scriptsize}
\end{tikzpicture}
\end{tabular}


\item
$0<q<200$ ve $\dfrac{59}{80} < \dfrac{p}{q} <\dfrac{45}{61}$ koşullarını sağlayan bir $(p,q)$ tamsayı çifti bulunuz ve böyle tek bir $(p,q)$ tamsayı çifti olduğunu gösteriniz.

\item
$7$ arkadaşı olan bir kimse, bir hafta boyunca her akşam $3$ arkadaşını yemeğe çağırır. Farklı iki akşam yemeğe çağrılan gruplar birbirlerinden farklı olup; $7$ arkadaştan her biri en az bir akşam yemeğe çağrılmaktadır. Bu koşulları sağlayan kaç değişik çağrı programı yapılabileceğini bulunuz.

\item
\begin{tabular}[t]{p{7cm}r}

$O$ merkezli çemberin yarıçapı $R$'dir. $A$ merkezli $|AB|$ yarıçaplı çember ile $B$ merkezli $|BA|$ yarıçaplı çemberin $D$ kesim noktası alınıyor. $CD$ doğrusu, $O$ merkezli çemberi $E$ noktasında kestiğine göre $|ED|$ uzunluğunu $R$ cinsinden hesaplayınız. 

&
\begin{tikzpicture}[baseline=(current bounding box.north),line cap=round,line join=round,>=triangle 45,x=1.0cm,y=1.0cm]

\clip(-0.16,-1.88) rectangle (6.4,3.52);
\draw [line width=1.2pt] (4.02,0.3) circle (2.16cm);
\draw [line width=1.2pt] (4.55,2.4) circle (1.08cm);
\draw [line width=1.2pt] (3.47,2.39) circle (1.08cm);
\draw [line width=1.2pt] (1.93,0.87)-- (5.5,1.88);
\draw [line width=1.2pt] (1.93,0.87)-- (1.04,0.62);
\draw (4.04,0.04) node[anchor=north west] {$O$};
\draw (5.74,1.94) node[anchor=north west] {$C$};
\draw (4.78,2.58) node[anchor=north west] {$A$};
\draw (3.1,2.62) node[anchor=north west] {$B$};
\draw (1.56,1.12) node[anchor=north west] {$E$};
\draw (4.10,1.25) node[anchor=south east] {$D$};
\begin{scriptsize}
\fill [color=ffffff] (4.02,0.3) circle (2.0pt);
\fill [color=ffffff] (5.5,1.88) circle (2.0pt);
\fill [color=ffffff] (4.55,2.4) circle (2.0pt);
\fill [color=ffffff] (3.47,2.39) circle (2.0pt);
\fill [color=ffffff] (4.01,1.46) circle (2.0pt);
\fill [color=ffffff] (1.93,0.87) circle (2.0pt);
\end{scriptsize}
\end{tikzpicture}

\end{tabular}

\item
$$\sqrt{x - \dfrac{1987}{14}} + \sqrt{x - \dfrac{1988}{13}} + \sqrt{x - \dfrac{1989}{12}} = \sqrt{x - \dfrac{14}{1987}} + \sqrt{x - \dfrac{13}{1988}} + \sqrt{x - \dfrac{12}{1989}}$$
denkleminin tüm reel çözümlerini bulunuz.

\item
İki kişinin bir keki paylaşmasının her iki tarafı da hoşnut eden ve adil bir yöntemi şudur: Biri keki iki parçaya ayırır, diğeri parçalardan birini kendine seçer. Diğer bir deyişle keki $[0,1]$ aralığı gibi düşünürsek, birinci kişi $x_1\in [0,1]$ seçer; ikinci kişi ise $x_1$ ve $1-x_1$ sayılarından birini seçer. (Burada her iki tarafın da ``keksever'' olduğu varsayıldığından, ikinci kişinin $x_1$ ve $1-x_1$ sayılarından daha büyük olanını seçeceği ve dolayısıyla birincinin de $x_1 = \dfrac 12$ seçimini yapacağı kolaylıkla görülür.) Üç keksever kişi için benzer bir paylaşma yöntemi bulabilir misiniz? 



\end{enumerate}

\end{document}
  • I am not sure what you want to achieve. Do you want the text to wrap around the figure? – Gonzalo Medina Apr 9 '13 at 13:06
  • Yes. Or Text is one side, figure is another side. – user706071 Apr 9 '13 at 13:10
  • But your code already shows the text to the left and the image to the right. What exactly seems to be the problem? What are you trying to achieve? Can you please add to your question a description of your intent? – Gonzalo Medina Apr 9 '13 at 13:39
  • in my code, text begins in middle of figure. i want they begin at same line. i try it by setting baseline but it didn't work. using tabular is not required. wrapping mlso can be useful. – user706071 Apr 10 '13 at 5:20
7

Firstly, your code can't compile with \usepackage[turkish]{babel} and without \shorthandoff{=}. Now I have some difficulties to give an answer with tikz's code like this. I think your code comes from Geogebra or something like this. So in the part A, I try to give you some explanations to translate code from geogebra to something more readable and more understandable. The next code is now perfect because I try to get a code simple and very similar to your code.

Part A

Your are in front of a white paper with some pencils.

a) Select a pencil You need to select the color and the size. By default the color is black and the size is 0.4pt. In your code \definecolor{ffffff}{rgb}{1,1,1} defines a color; rgb 1,1,1 is the white color and it's very strange but unnecessary. Tikz loads the xcolor package and this package defines some fundamental colors like white and black. If you keep on running Geogebra, you can use an editor to change all code like ffffff by white. An example \definecolor{mycolor}{rgb}{.2,1,.5}. For the size line width=0.5pt is given at the beginning because this size is used for the drawings. line width=1.2pt is too large for me but ...

b) Now you need draw little circles. You choose a point on the paper (a,b) ofr the first point point (0,0) is fine. We need to use this point after so it's possible to name the point . You give a name with coordinate (a). After this you write the label $A$ with the same pencil. With tikz, a label or a text can be place with a node. By default the node is a rectangle and you write $A$ on it. You can attach the rectangle to the point with an anchor here anchor=north west.

With the same pencil, you add B, C and D. The circles are filled. You can fill the circles with the option [fill]. Remark : by default, the color is black if you want another color, fill=gray for example.

c) Now we can draw the lines. Same color and same size we draw the quadrilatere \draw (a) -- (b) -- (c) --(d) -- cycle; cycle is used to close the path

d) The point E and F. F is a point on the line AC. It's easy to define it with barycentric's coordinates. E in my example is at the intersection of two lines AC and BD. We name the lines (the paths) with name path

\draw (a) -- (b) -- (c) --(d) -- cycle;
\draw [name path=ac] (a) -- (c);
\draw [name path=bd] (b) -- (d);

I get the intersection with `name intersections={of=ac and bd, by=e}``

You can avoid the last steps because Geogebra can gives you the coordinates of E and F but I think you need to place A, B, C and D with simple coordinates. It's more readable.

Complete code for the picture

\begin{tikzpicture}[scale=.4,line width=0.5pt]
\draw[fill] (0,0)  coordinate (a)  circle (4pt)   node[anchor=north west] {$A$}
            (11,0) coordinate (b)  circle (4pt)   node[anchor=north west] {$B$}
            (9,3)  coordinate (c)  circle (4pt)   node[anchor=south west] {$C$} 
            (3,4) coordinate (d)   circle (4pt)   node[anchor=south west] {$D$} ;
 \draw (a) -- (b) -- (c) --(d) -- cycle;
 \draw [name path=ac] (a) -- (c);
 \draw [name path=bd] (b) -- (d);
 \draw [name intersections={of=ac and bd, by=e},fill] (e) circle (4pt) node[anchor=north] {$E$};
 \draw[fill]  (barycentric cs:a=1,c=1) coordinate (f) circle (4pt) node[anchor=north] {$F$};;
\end{tikzpicture}

remarks : I removed the baseline option : the box is not placed relatively to a line. I removed also x= ... and y=.... It's more simple to use the default 1cm for x and y and then use a scale.

Part B

I used the picinspackage to place the pictures inside text. You can find it here

It's not on texlive and you need to download it. wrapfig package is incompatible with the enumerate list.

You need the to load \usepackage{mdwlist}. This package is usefull because when you use the macro \parpic of the picins package, the indent margin is false so you need to add before the next item

\suspend{enumerate} \resume{enumerate}

The complete code can help you :

\documentclass{article}
\usepackage[utf8]{inputenc}
\usepackage[margin=6.0em]{geometry}
\usepackage{tikz}
\usetikzlibrary{intersections}
\usepackage{picins}
%  http://tug.ctan.org/tex-archive/macros/latex209/contrib/picins/picins.sty
\usepackage{mdwlist}
\usepackage{multicol,lipsum}
\usetikzlibrary{arrows}

\begin{document}
\begin{multicols}{2}
\begin{enumerate}

    \item 
\parpic[l]{%
\begin{tikzpicture}[scale=.25,line width=0.5pt]
\draw[fill] (0,0)  coordinate (a)  circle (4pt)   node[anchor=north west] {$A$}
            (11,0) coordinate (b)  circle (4pt)   node[anchor=north west] {$B$}
            (9,3)  coordinate (c)  circle (4pt)   node[anchor=south west] {$C$} 
            (3,4) coordinate (d)   circle (4pt)   node[anchor=south west] {$D$} ;
 \draw (a) -- (b) -- (c) --(d) -- cycle;
 \draw [name path=ac] (a) -- (c);
 \draw [name path=bd] (b) -- (d);
 \draw [name intersections={of=ac and bd, by=e},fill] (e) circle (4pt) node[anchor=north] {$E$};
 \draw[fill]  (barycentric cs:a=1,c=1) coordinate (f) circle (4pt) node[anchor=north] {$F$};;
\end{tikzpicture}
}%
\lipsum[1]
\suspend{enumerate}
\resume{enumerate}

\item   \parpic[r]{%
\begin{tikzpicture}[scale=.4,line width=0.5pt]
\draw[fill] (0,0)  coordinate (a)  circle (4pt)   node[anchor=north west] {$A$}
            (11,0) coordinate (b)  circle (4pt)   node[anchor=north west] {$B$}
            (9,3)  coordinate (c)  circle (4pt)   node[anchor=south west] {$C$} 
            (3,4) coordinate (d)   circle (4pt)   node[anchor=south west] {$D$} ;
 \draw (a) -- (b) -- (c) --(d) -- cycle;
 \draw [name path=ac] (a) -- (c);
 \draw [name path=bd] (b) -- (d);
 \draw [name intersections={of=ac and bd, by=e},fill] (e) circle (4pt) node[anchor=north] {$E$};
 \draw[fill]  (barycentric cs:a=1,c=1) coordinate (f) circle (4pt) node[anchor=north] {$F$};;
\end{tikzpicture}
}%
\lipsum[1-1]

\end{enumerate}
\end{multicols}

\begin{enumerate}

    \item 
\parpic[l]{%
\begin{tikzpicture}[scale=.8,line width=0.5pt]
\draw[fill] (0,0)  coordinate (a)  circle (4pt)   node[anchor=north west] {$A$}
            (11,0) coordinate (b)  circle (4pt)   node[anchor=north west] {$B$}
            (9,3)  coordinate (c)  circle (4pt)   node[anchor=south west] {$C$} 
            (3,4) coordinate (d)   circle (4pt)   node[anchor=south west] {$D$} ;
 \draw (a) -- (b) -- (c) --(d) -- cycle;
 \draw [name path=ac] (a) -- (c);
 \draw [name path=bd] (b) -- (d);
 \draw [name intersections={of=ac and bd, by=e},fill] (e) circle (4pt) node[anchor=north] {$E$};
 \draw[fill]  (barycentric cs:a=1,c=1) coordinate (f) circle (4pt) node[anchor=north] {$F$};;
\end{tikzpicture}
}%
\lipsum[1]
\suspend{enumerate}
\resume{enumerate}

\item   \parpic[r]{%
\begin{tikzpicture}[scale=.5,line width=0.5pt]
\draw[fill] (0,0)  coordinate (a)  circle (4pt)   node[anchor=north west] {$A$}
            (11,0) coordinate (b)  circle (4pt)   node[anchor=north west] {$B$}
            (9,3)  coordinate (c)  circle (4pt)   node[anchor=south west] {$C$} 
            (3,4) coordinate (d)   circle (4pt)   node[anchor=south west] {$D$} ;
 \draw (a) -- (b) -- (c) --(d) -- cycle;
 \draw [name path=ac] (a) -- (c);
 \draw [name path=bd] (b) -- (d);
 \draw [name intersections={of=ac and bd, by=e},fill] (e) circle (4pt) node[anchor=north] {$E$};
 \draw[fill]  (barycentric cs:a=1,c=1) coordinate (f) circle (4pt) node[anchor=north] {$F$};;
\end{tikzpicture}
}%  
\lipsum[1-1]

\end{enumerate}
\end{document}  

You can see a little problem when I change the scale for the picture, the circles are bigger and it's a problem for the labels. It's why the code is not perfect but I tried to get a code similar to the geogebra's code.

enter image description here

| improve this answer | |
0

See the package wrapfig (documentation also available online).

| improve this answer | |
  • 3
    Just pointing somewhere (else) doesn't add much value. Please provide some more detail of how one would use wrapfig to solve the problem. – Werner Apr 10 '13 at 4:33
  • 2
    wrapfig doesn't work in lists but the figure is in the enumerate environment. – percusse Apr 10 '13 at 8:54

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.