LaTeX specific issues not fitting into one of the other forums of this category.
blindax
Posts: 2 Joined: Sat Dec 01, 2012 3:09 pm
Post
by blindax » Sat Dec 01, 2012 3:14 pm
Hi,
I´m new to TeX and I am trying to create a chessboard 8x8 using boxes. I use this code
Code: Select all
\hskip 2cm \vrule width 2cm height 2cm \relax \hskip 2cm \vrule width 2cm height 2cm \relax \hskip 2cm \vrule width 2cm height 2cm \relax \hskip 2cm \vrule width 2cm height 2cm
\vrule width 2cm height 2cm \relax \hskip 2cm \vrule width 2cm height 2cm \relax \hskip 2cm \vrule width 2cm height 2cm \relax \hskip 2cm \vrule width 2cm height 2cm \relax
\hskip 2cm \vrule width 2cm height 2cm \relax \hskip 2cm \vrule width 2cm height 2cm \relax \hskip 2cm \vrule width 2cm height 2cm \relax \hskip 2cm \vrule width 2cm height 2cm \par
\vrule width 2cm height 2cm \relax \hskip 2cm \vrule width 2cm height 2cm \relax \hskip 2cm \vrule width 2cm height 2cm \relax \hskip 2cm \vrule width 2cm height 2cm \relax
\hskip 2cm \vrule width 2cm height 2cm \relax \hskip 2cm \vrule width 2cm height 2cm \relax \hskip 2cm \vrule width 2cm height 2cm \relax \hskip 2cm \vrule width 2cm height 2cm \par
\vrule width 2cm height 2cm \relax \hskip 2cm \vrule width 2cm height 2cm \relax \hskip 2cm \vrule width 2cm height 2cm \relax \hskip 2cm \vrule width 2cm height 2cm \relax
\hskip 2cm \vrule width 2cm height 2cm \relax \hskip 2cm \vrule width 2cm height 2cm \relax \hskip 2cm \vrule width 2cm height 2cm \relax \hskip 2cm \vrule width 2cm height 2cm \par
\vrule width 2cm height 2cm \relax \hskip 2cm \vrule width 2cm height 2cm \relax \hskip 2cm \vrule width 2cm height 2cm \relax \hskip 2cm \vrule width 2cm height 2cm \relax
\bye
My question is why is the last black square (on right side) longer? And is there a way to draw lines around every column/row to make it look like chessboard? thanks
NEW: TikZ book now 40% off at Amazon.com for a short time.
cgnieder
Site Moderator
Posts: 2000 Joined: Sat Apr 16, 2011 7:27 pm
Post
by cgnieder » Sat Dec 01, 2012 4:38 pm
Hi blindax,
welcome to the LaTeX community!
I'm not really sure why the last vrule isn't a square but it must have to to with the parindent since saying
\parindent=0pt
fixes the issue. I rarely use plain TeX so use the following at you own risk
Code: Select all
\def\squarelength{2cm}
\def\white{%
\vrule width 0pt\relax
\vbox{%
\hrule height .5pt\relax
\hbox{%
\vrule width .5pt\relax\kern\squarelength\relax\kern-1pt\relax
\vbox{\kern\squarelength\relax\kern-1pt\relax}\vrule width.5pt\relax}%
\hrule height .5pt\relax
}}
\def\black{\vrule width \squarelength height \squarelength\relax}
\def\wbline{\white\black\white\black\white\black\white\black\vskip-1pt\relax}
\def\bwline{\black\white\black\white\black\white\black\white\vskip-1pt\relax}
\def\chessboard{%
\begingroup
\parindent=0pt\relax
\wbline\bwline\wbline\bwline\wbline\bwline\wbline\bwline
\endgroup}
\chessboard
\bye
Regards
blindax
Posts: 2 Joined: Sat Dec 01, 2012 3:09 pm
Post
by blindax » Sat Dec 08, 2012 8:29 pm
Thanks, this is exactly what i didn´t get. I knew about the package but I just wanted to do it my way.