Rectangle and Labels

View: New views
6 Messages — Rating Filter:   Alert me  

Rectangle and Labels

by dwarnold :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

All,

Using Tikz in Latex, I'd like to:

1. Draw a rectangle with lower left corner at the origin.

2. Rotate the rectangle 45 degrees about the origin.

3. Put a label $R(A)$ in the center of the rotated rectangle.

4. Put a label $n$ on the upper left-hand side of the rotated rectangle.

Any help appreciated.

Thanks

David

------------------------------------------------------------------------------
Come build with us! The BlackBerry(R) Developer Conference in SF, CA
is the only developer event you need to attend this year. Jumpstart your
developing skills, take BlackBerry mobile applications to market and stay
ahead of the curve. Join us from November 9 - 12, 2009. Register now!
http://p.sf.net/sfu/devconference
_______________________________________________
pgf-users mailing list
pgf-users@...
https://lists.sourceforge.net/lists/listinfo/pgf-users

Re: Rectangle and Labels

by André Valentin-2 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Hello,

That's easy:

\begin{tikzpicture}[rotate=45]
\draw (0,0) rectangle(10,6);
\node at (5,3){$R(A)$};
\node [right=3mm] at (0,6){$n$};
\end{tikzpicture}



Le 22 oct. 2009 à 21:10, David Arnold a écrit :

>
> All,
>
> Using Tikz in Latex, I'd like to:
>
> 1. Draw a rectangle with lower left corner at the origin.
>
> 2. Rotate the rectangle 45 degrees about the origin.
>
> 3. Put a label $R(A)$ in the center of the rotated rectangle.
>
> 4. Put a label $n$ on the upper left-hand side of the rotated  
> rectangle.
>
> Any help appreciated.
>
> Thanks
>
> David
>
> ------------------------------------------------------------------------------
> Come build with us! The BlackBerry(R) Developer Conference in SF, CA
> is the only developer event you need to attend this year. Jumpstart  
> your
> developing skills, take BlackBerry mobile applications to market and  
> stay
> ahead of the curve. Join us from November 9 - 12, 2009. Register now!
> http://p.sf.net/sfu/devconference
> _______________________________________________
> pgf-users mailing list
> pgf-users@...
> https://lists.sourceforge.net/lists/listinfo/pgf-users
>




------------------------------------------------------------------------------
Come build with us! The BlackBerry(R) Developer Conference in SF, CA
is the only developer event you need to attend this year. Jumpstart your
developing skills, take BlackBerry mobile applications to market and stay
ahead of the curve. Join us from November 9 - 12, 2009. Register now!
http://p.sf.net/sfu/devconference
_______________________________________________
pgf-users mailing list
pgf-users@...
https://lists.sourceforge.net/lists/listinfo/pgf-users

Re: Rectangle and Labels

by Mark Wibrow-2 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Hi,

2009/10/22 André Valentin <ajj47.valentin@...>:

> Hello,
>
> That's easy:
>
> \begin{tikzpicture}[rotate=45]
> \draw (0,0) rectangle(10,6);
> \node at (5,3){$R(A)$};
> \node [right=3mm] at (0,6){$n$};
> \end{tikzpicture}
>
>

In the interests of variety (although the second one is pretty much
the same as the one above):

\documentclass{minimal}
\usepackage{tikz}

\begin{document}

\def\height{1.5cm}
\def\width{3cm}

\tikzset{
        rotated rectangle/.style={
                shape=rectangle,
          minimum width=\width,
          minimum height=\height,
          draw,
          rotate=#1,
    anchor=south west
  }
}

\begin{tikzpicture}
        \draw [help lines] grid (3cm, 2cm);
  \node [
          rotated rectangle=45,
    label=center:$R(A)$,
    label=north:$n$
        ] (R) {};
       
\end{tikzpicture}

\begin{tikzpicture}
        \draw [help lines] grid (3cm, 2cm);
  \begin{scope}[rotate=45]
  \draw (0cm, 0cm) rectangle (\width, \height);
  \node at (\width/2, \height/2) {$R(A)$};
  \node [above=1ex] at (\width/2, \height) {$n$};
  \end{scope}
\end{tikzpicture}

\end{document}

Regards

Mark

------------------------------------------------------------------------------
Come build with us! The BlackBerry(R) Developer Conference in SF, CA
is the only developer event you need to attend this year. Jumpstart your
developing skills, take BlackBerry mobile applications to market and stay
ahead of the curve. Join us from November 9 - 12, 2009. Register now!
http://p.sf.net/sfu/devconference
_______________________________________________
pgf-users mailing list
pgf-users@...
https://lists.sourceforge.net/lists/listinfo/pgf-users

Parent Message unknown Re: Rectangle and Labels

by Mark Wibrow-2 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Hi,

Hmm. It should compile. It compiles for me, but I'm using the (sort
of) latest CVS version, but I don't think there is anything in there
that shouldn't work with the last 2.0 release.

I guess from the error message it is the first example that fails.
Does the second one work?

Regards

Mark

2009/10/22 David Arnold <dwarnold45@...>:

> Mark,
> These are the ideas I'm looking for, but it didn't compile.
> ! Missing number, treated as zero.
> <to be read again>
>                    c
> l.26 ] (R) {};
>
>
>
> ?
> David
> On Oct 22, 2009, at 1:26 PM, Mark Wibrow wrote:
>
> Hi,
>
> 2009/10/22 André Valentin <ajj47.valentin@...>:
>
> Hello,
>
> That's easy:
>
> \begin{tikzpicture}[rotate=45]
>
> \draw (0,0) rectangle(10,6);
>
> \node at (5,3){$R(A)$};
>
> \node [right=3mm] at (0,6){$n$};
>
> \end{tikzpicture}
>
>
>
> In the interests of variety (although the second one is pretty much
> the same as the one above):
>
> \documentclass{minimal}
> \usepackage{tikz}
>
> \begin{document}
>
> \def\height{1.5cm}
> \def\width{3cm}
>
> \tikzset{
> rotated rectangle/.style={
> shape=rectangle,
>  minimum width=\width,
>  minimum height=\height,
>  draw,
>  rotate=#1,
>    anchor=south west
>  }
> }
>
> \begin{tikzpicture}
> \draw [help lines] grid (3cm, 2cm);
>  \node [
>  rotated rectangle=45,
>    label=center:$R(A)$,
>    label=north:$n$
> ] (R) {};
>
> \end{tikzpicture}
>
> \begin{tikzpicture}
> \draw [help lines] grid (3cm, 2cm);
>  \begin{scope}[rotate=45]
>   \draw (0cm, 0cm) rectangle (\width, \height);
>   \node at (\width/2, \height/2) {$R(A)$};
>   \node [above=1ex] at (\width/2, \height) {$n$};
>  \end{scope}
> \end{tikzpicture}
>
> \end{document}
>
> Regards
>
> Mark
>
> ------------------------------------------------------------------------------
> Come build with us! The BlackBerry(R) Developer Conference in SF, CA
> is the only developer event you need to attend this year. Jumpstart your
> developing skills, take BlackBerry mobile applications to market and stay
> ahead of the curve. Join us from November 9 - 12, 2009. Register now!
> http://p.sf.net/sfu/devconference
> _______________________________________________
> pgf-users mailing list
> pgf-users@...
> https://lists.sourceforge.net/lists/listinfo/pgf-users
>
>

------------------------------------------------------------------------------
Come build with us! The BlackBerry(R) Developer Conference in SF, CA
is the only developer event you need to attend this year. Jumpstart your
developing skills, take BlackBerry mobile applications to market and stay
ahead of the curve. Join us from November 9 - 12, 2009. Register now!
http://p.sf.net/sfu/devconference
_______________________________________________
pgf-users mailing list
pgf-users@...
https://lists.sourceforge.net/lists/listinfo/pgf-users

Re: Rectangle and Labels

by dwarnold :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Mark,

The second one does work. I've adapted it to:

\documentclass{minimal}
\usepackage{tikz}

\begin{document}

\def\height{1.5cm}
\def\width{3cm}

\begin{tikzpicture}
        \begin{scope}[rotate=45]
          \draw (0cm, 0cm) rectangle (\width, \height);
          \node at (\width/2, \height/2) {$R(A)$};
          \node [above=1ex] at (\width/2, \height) {$2$};
        \end{scope}
        \begin{scope}[rotate=-45,yshift=-\height]
          \draw (0cm, 0cm) rectangle (\width, \height);
          \node at (\width/2, \height/2) {$N(A)$};
          \node [below=1ex] at (\width/2, 0) {$2$};
        \end{scope}
        \node[right=1ex] at (0,0) {$R^4$};
        \begin{scope}[xscale=-1,xshift=-5cm]
                \begin{scope}[rotate=45]
                  \draw (0cm, 0cm) rectangle (\width, \height);
                  \node at (\width/2, \height/2) {$C(A)$};
                  \node [above=1ex] at (\width/2, \height) {$2$};
                \end{scope}
                \begin{scope}[rotate=-45,yshift=-\height]
                  \draw (0cm, 0cm) rectangle (\width, \height);
                  \node at (\width/2, \height/2) {$N(A^T)$};
                  \node [below=1ex] at (\width/2, 0) {$1$};
                \end{scope}
                \node[left=1ex] at (0,0) {$R^3$};
        \end{scope}
\end{tikzpicture}

\end{document}

Comments, criticisms, and suggestions are welcome.

I still need to center the matrix A in the middle of the diagram  
(working on that) and putting a basis for each space above R(A), C(A)  
and below N(A), N(A^T) (worging on that).

David.
On Oct 22, 2009, at 4:56 PM, Mark Wibrow wrote:

> Hi,
>
> Hmm. It should compile. It compiles for me, but I'm using the (sort
> of) latest CVS version, but I don't think there is anything in there
> that shouldn't work with the last 2.0 release.
>
> I guess from the error message it is the first example that fails.
> Does the second one work?
>
> Regards
>
> Mark
>
> 2009/10/22 David Arnold <dwarnold45@...>:
>> Mark,
>> These are the ideas I'm looking for, but it didn't compile.
>> ! Missing number, treated as zero.
>> <to be read again>
>>                    c
>> l.26 ] (R) {};
>>
>>
>>
>> ?
>> David
>> On Oct 22, 2009, at 1:26 PM, Mark Wibrow wrote:
>>
>> Hi,
>>
>> 2009/10/22 André Valentin <ajj47.valentin@...>:
>>
>> Hello,
>>
>> That's easy:
>>
>> \begin{tikzpicture}[rotate=45]
>>
>> \draw (0,0) rectangle(10,6);
>>
>> \node at (5,3){$R(A)$};
>>
>> \node [right=3mm] at (0,6){$n$};
>>
>> \end{tikzpicture}
>>
>>
>>
>> In the interests of variety (although the second one is pretty much
>> the same as the one above):
>>
>> \documentclass{minimal}
>> \usepackage{tikz}
>>
>> \begin{document}
>>
>> \def\height{1.5cm}
>> \def\width{3cm}
>>
>> \tikzset{
>> rotated rectangle/.style={
>> shape=rectangle,
>>  minimum width=\width,
>>  minimum height=\height,
>>  draw,
>>  rotate=#1,
>>    anchor=south west
>>  }
>> }
>>
>> \begin{tikzpicture}
>> \draw [help lines] grid (3cm, 2cm);
>>  \node [
>>  rotated rectangle=45,
>>    label=center:$R(A)$,
>>    label=north:$n$
>> ] (R) {};
>>
>> \end{tikzpicture}
>>
>> \begin{tikzpicture}
>> \draw [help lines] grid (3cm, 2cm);
>>  \begin{scope}[rotate=45]
>>   \draw (0cm, 0cm) rectangle (\width, \height);
>>   \node at (\width/2, \height/2) {$R(A)$};
>>   \node [above=1ex] at (\width/2, \height) {$n$};
>>  \end{scope}
>> \end{tikzpicture}
>>
>> \end{document}
>>
>> Regards
>>
>> Mark
>>
>> ------------------------------------------------------------------------------
>> Come build with us! The BlackBerry(R) Developer Conference in SF, CA
>> is the only developer event you need to attend this year. Jumpstart  
>> your
>> developing skills, take BlackBerry mobile applications to market  
>> and stay
>> ahead of the curve. Join us from November 9 - 12, 2009. Register now!
>> http://p.sf.net/sfu/devconference
>> _______________________________________________
>> pgf-users mailing list
>> pgf-users@...
>> https://lists.sourceforge.net/lists/listinfo/pgf-users
>>
>>


------------------------------------------------------------------------------
Come build with us! The BlackBerry(R) Developer Conference in SF, CA
is the only developer event you need to attend this year. Jumpstart your
developing skills, take BlackBerry mobile applications to market and stay
ahead of the curve. Join us from November 9 - 12, 2009. Register now!
http://p.sf.net/sfu/devconference
_______________________________________________
pgf-users mailing list
pgf-users@...
https://lists.sourceforge.net/lists/listinfo/pgf-users

Re: Rectangle and Labels

by dwarnold :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Mark et al,

Finished product:

\documentclass{article}
\usepackage{tikz}
\usepackage{amsmath}

\newcommand\ihat{\mathbf i}
\newcommand\jhat{\mathbf j}
\newcommand\khat{\mathbf k}

\renewcommand\vec[1]{\mathbf{#1}}
\newcommand{\norm}[1]{\lVert#1\rVert}

\newcommand\twovec[2]{\begin{bmatrix}#1\\#2\end{bmatrix}}
\newcommand\threevec[3]{\begin{bmatrix}#1\\#2\\#3\end{bmatrix}}
\newcommand\twomat[4]{\begin{bmatrix}#1\\#3\end{bmatrix}}
\newcommand\threemat[9]{\begin{bmatrix}#1\\#4\
\#7 \end{bmatrix}}

\newcommand\qand{\quad\text{and}\quad}
\newcommand\qor{\quad\text{or}\quad}
\newcommand\qqand{\qquad\text{and}\qquad}
\newcommand\qqor{\qquad\text{or}\qquad}

\begin{document}

\def\height{1.5cm}
\def\width{3cm}

\begin{tikzpicture}
        \begin{scope}[rotate=45]
          \draw (0cm, 0cm) rectangle (\width, \height);
          \node at (\width/2, \height/2) {$R(A)$};
          \node [above=1ex] at (\width/2, \height) {$2$};
        \end{scope}
        \begin{scope}[rotate=-45,yshift=-\height]
          \draw (0cm, 0cm) rectangle (\width, \height);
          \node at (\width/2, \height/2) {$N(A)$};
          \node [below=1ex] at (\width/2, 0) {$2$};
        \end{scope}
        \node[right=1ex] at (0,0) {$R^4$};
        \node at (5,0) {$A=
                \threemat1001101{-1}1
                \begin{bmatrix}
                1&0&-2&-4\\0&1&1&-5\\0&0&0&0
                \end{bmatrix}$};
        \node[above] at (0,3.5) {$\mathcal{B}=\left\{\begin{bmatrix}1\\0\\-2\
\-4\end{bmatrix},\begin{bmatrix}0\\1\\1\\-5\end{bmatrix}\right\}$};
        \node[below] at (0,-3.5) {$\mathcal{B}=\left\{\begin{bmatrix}2\\-1\\1\
\0\end{bmatrix},\begin{bmatrix}4\\5\\0\\1\end{bmatrix}\right\}$};
        \begin{scope}[xscale=-1,xshift=-10cm]
                \begin{scope}[rotate=45]
                  \draw (0cm, 0cm) rectangle (\width, \height);
                  \node at (\width/2, \height/2) {$C(A)$};
                  \node [above=1ex] at (\width/2, \height) {$2$};
                \end{scope}
                \begin{scope}[rotate=-45,yshift=-\height]
                  \draw (0cm, 0cm) rectangle (\width, \height);
                  \node at (\width/2, \height/2) {$N(A^T)$};
                  \node [below=1ex] at (\width/2, 0) {$1$};
                \end{scope}
                \node[left=1ex] at (0,0) {$R^3$};
        \node[above] at (0,3.5) {$\mathcal{B}=\left\{\begin{bmatrix}1\\1\
\1\end{bmatrix},\begin{bmatrix}0\\1\\-1\end{bmatrix}\right\}$};
        \node[below] at (0,-3.5) {$\mathcal{B}=\left\{\begin{bmatrix}-2\\1\
\1\end{bmatrix}\right\}$};
        \end{scope}
\end{tikzpicture}

\end{document}

Comments, criticisms, suggestions welcome.

David.
On Oct 22, 2009, at 4:56 PM, Mark Wibrow wrote:

> Hi,
>
> Hmm. It should compile. It compiles for me, but I'm using the (sort
> of) latest CVS version, but I don't think there is anything in there
> that shouldn't work with the last 2.0 release.
>
> I guess from the error message it is the first example that fails.
> Does the second one work?
>
> Regards
>
> Mark
>
> 2009/10/22 David Arnold <dwarnold45@...>:
>> Mark,
>> These are the ideas I'm looking for, but it didn't compile.
>> ! Missing number, treated as zero.
>> <to be read again>
>>                    c
>> l.26 ] (R) {};
>>
>>
>>
>> ?
>> David
>> On Oct 22, 2009, at 1:26 PM, Mark Wibrow wrote:
>>
>> Hi,
>>
>> 2009/10/22 André Valentin <ajj47.valentin@...>:
>>
>> Hello,
>>
>> That's easy:
>>
>> \begin{tikzpicture}[rotate=45]
>>
>> \draw (0,0) rectangle(10,6);
>>
>> \node at (5,3){$R(A)$};
>>
>> \node [right=3mm] at (0,6){$n$};
>>
>> \end{tikzpicture}
>>
>>
>>
>> In the interests of variety (although the second one is pretty much
>> the same as the one above):
>>
>> \documentclass{minimal}
>> \usepackage{tikz}
>>
>> \begin{document}
>>
>> \def\height{1.5cm}
>> \def\width{3cm}
>>
>> \tikzset{
>> rotated rectangle/.style={
>> shape=rectangle,
>>  minimum width=\width,
>>  minimum height=\height,
>>  draw,
>>  rotate=#1,
>>    anchor=south west
>>  }
>> }
>>
>> \begin{tikzpicture}
>> \draw [help lines] grid (3cm, 2cm);
>>  \node [
>>  rotated rectangle=45,
>>    label=center:$R(A)$,
>>    label=north:$n$
>> ] (R) {};
>>
>> \end{tikzpicture}
>>
>> \begin{tikzpicture}
>> \draw [help lines] grid (3cm, 2cm);
>>  \begin{scope}[rotate=45]
>>   \draw (0cm, 0cm) rectangle (\width, \height);
>>   \node at (\width/2, \height/2) {$R(A)$};
>>   \node [above=1ex] at (\width/2, \height) {$n$};
>>  \end{scope}
>> \end{tikzpicture}
>>
>> \end{document}
>>
>> Regards
>>
>> Mark
>>
>> ------------------------------------------------------------------------------
>> Come build with us! The BlackBerry(R) Developer Conference in SF, CA
>> is the only developer event you need to attend this year. Jumpstart  
>> your
>> developing skills, take BlackBerry mobile applications to market  
>> and stay
>> ahead of the curve. Join us from November 9 - 12, 2009. Register now!
>> http://p.sf.net/sfu/devconference
>> _______________________________________________
>> pgf-users mailing list
>> pgf-users@...
>> https://lists.sourceforge.net/lists/listinfo/pgf-users
>>
>>


------------------------------------------------------------------------------
Come build with us! The BlackBerry(R) Developer Conference in SF, CA
is the only developer event you need to attend this year. Jumpstart your
developing skills, take BlackBerry mobile applications to market and stay
ahead of the curve. Join us from November 9 - 12, 2009. Register now!
http://p.sf.net/sfu/devconference
_______________________________________________
pgf-users mailing list
pgf-users@...
https://lists.sourceforge.net/lists/listinfo/pgf-users