Skip to content

Instantly share code, notes, and snippets.

@hzhangxyz
Last active April 25, 2017 02:53
Show Gist options
  • Save hzhangxyz/25dfbdf5c0519473b218e5e920fdb119 to your computer and use it in GitHub Desktop.
Save hzhangxyz/25dfbdf5c0519473b218e5e920fdb119 to your computer and use it in GitHub Desktop.
tex print square
\documentclass{article}
\usepackage{xcolor}
\begin{document}
{\centering
\count2=10\def\content{O}
\count0=0\loop\ifnum\count0<\count2{
\count1=0\loop \ifnum\count1<\the\numexpr \count2-\count0 {
{\color{white}\content}
}\advance\count1 by 1\repeat
\count1=0\loop \ifnum\count1<\the\numexpr 2*\count0-1{
\content
}\advance\count1 by 1\repeat
\count1=0\loop \ifnum\count1<\the\numexpr \count2-\count0 {
{\color{white}\content}
}\advance\count1 by 1\repeat
}\advance\count0 by 1\repeat
\count0=\count2\loop\ifnum\count0>0{
\count1=0\loop \ifnum\count1<\the\numexpr \count2-\count0 {
{\color{white}\content}
}\advance\count1 by 1\repeat
\count1=0\loop \ifnum\count1<\the\numexpr 2*\count0-1{
\content
}\advance\count1 by 1\repeat
\count1=0\loop \ifnum\count1<\the\numexpr \count2-\count0 {
{\color{white}\content}
}\advance\count1 by 1\repeat
}\advance\count0 by -1\repeat
}
\end{document}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment