6

I want to create a two column question with a Tikz shape. The problem here is that I cannot align the text and the shape. Text should have a left-top alignment, shape can have either center-center or right-top alignment.

\item

\begin{tabular}{p{8cm}p{7cm}}    
$1$ den $10$ a kadar olan tam sayılar, yandaki şekildeki on kutuya yerleştiriliyor. En üst sıradakiler dışında her kutudaki sayı, hemen üstündeki iki kutuda bulunan sayıların farkına eşitse, en alttaki kutuya yerleştirilen sayı en çok kaç olabilir? 
&

\begin{tikzpicture}
\draw (0,0) rectangle (1,-1);
\draw (2,0) rectangle (3,-1);
\draw (4,0) rectangle (5,-1);
\draw (6,0) rectangle (7,-1);

\draw (1,-2) rectangle (2,-3);
\draw (3,-2) rectangle (4,-3);
\draw (5,-2) rectangle (6,-3);

\draw (2,-4) rectangle (3,-5);
\draw (4,-4) rectangle (5,-5);

\draw (3,-6) rectangle (4,-7);
\end{tikzpicture}
\end{tabular}

When I compiled the above latex code, I am getting :

               Shape 
               Shape
Text-Text-Text-Shape
text-text      Shape  
2
  • 3
    Have you tried \begin{tikzpicture}[baseline=(current bounding box.north)]? Sep 29, 2012 at 13:02
  • Ok. That works with one exception. Now, the \item number is at the center of the table.
    – user706071
    Sep 29, 2012 at 13:53

1 Answer 1

8

You can change the baseline by adding \begin{tikzpicture}[baseline=(current bounding box.north)] as told by Tom Bombadil in the comment. To bring the item number to the top, use positioning option [t] for tabular as \begin{tabular}[t]{p{8cm}p{7cm}}

The MWE:

\documentclass{article}
\usepackage[margin=.5in]{geometry}
\usepackage{tikz}
\begin{document}
\begin{enumerate}
\item 
\begin{tabular}[t]{p{8cm}p{7cm}}
$1$ den $10$ a kadar olan tam sayılar, yandaki şekildeki on kutuya yerleştiriliyor. En üst sıradakiler dışında her kutudaki sayı, hemen üstündeki iki kutuda bulunan sayıların farkına eşitse, en alttaki kutuya yerleştirilen sayı en çok kaç olabilir?
&\begin{tikzpicture}[baseline=(current bounding box.north)]
\draw (0,0) rectangle (1,-1);
\draw (2,0) rectangle (3,-1);
\draw (4,0) rectangle (5,-1);
\draw (6,0) rectangle (7,-1);
\draw (1,-2) rectangle (2,-3);
\draw (3,-2) rectangle (4,-3);
\draw (5,-2) rectangle (6,-3);
\draw (2,-4) rectangle (3,-5);
\draw (4,-4) rectangle (5,-5);
\draw (3,-6) rectangle (4,-7);
\end{tikzpicture}
\end{tabular}
\end{enumerate}
\end{document}

enter image description here

You must log in to answer this question.

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