Text along a Peano Curve in LaTeX for cover page
There is an explicit construction of Hilbert curve in the manual. All I did is copying the example code.
\documentclass[12pt]{article}
\usepackage{tikz,lipsum}
\usetikzlibrary{lindenmayersystems}
\usetikzlibrary{decorations.text}
\begin{document}
\pgfdeclarelindenmayersystem{Hilbert curve}{
\symbol{X}{\pgflsystemdrawforward}
\symbol{+}{\pgflsystemturnright} % Explicitly define + and - symbols.
\symbol{-}{\pgflsystemturnleft}
\rule{A -> +BX-AXA-XB+}
\rule{B -> -AX+BXB+XA-}
}
\tikz
\draw[
rounded corners=10pt,scale=5,
decoration={
text along path,
text={Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Aenean commodo ligula eget dolor. Aenean massa. Cum sociis natoque penatibus et magnis dis parturient montes, nascetur ridiculus mus. Donec quam felis, ultricies nec, pellentesque eu, pretium quis, sem. Nulla consequat massa quis enim. Donec pede justo, fringilla vel, aliquet nec, vulputate eget, arcu. In enim justo, rhoncus ut, imperdiet a, venenatis vitae, justo. Nullam dictum felis eu pede mollis pretium. Integer tincidunt. Cras dapibus. Vivamus elementum semper nisi. Aenean vulputate eleifend tellus. Aenean leo ligula, porttitor eu, consequat vitae, eleifend ac, enim. Aliquam lorem ante, dapibus in, viverra quis, feugiat a, tellus. Phasellus viverra nulla ut metus varius laoreet. Quisque rutrum. Aenean imperdiet. Etiam ultricies nisi vel augue. Curabitur ullamcorper ultricies nisi. Nam eget dui.},
},
decorate,
lindenmayer system={
Hilbert curve, axiom=A, order=4, angle=90
},
]
lindenmayer system
;
\end{document}
As a follow up, and following on @Symbol 1 solution I wanted to post a complete solution of what I wanted, in case it serves any purpose for anyone else. Since I think it may be more "general" and it touches on some other tikz keys.
Rounding corners seem to create a lot of overhall, hence why I had to remove it to be able to go up to order 5
To change the repeating text for a custom long text, remove the key "repeat text" and replace the chinese text for your own long text
(I am using XeLaTeX because of the chinese "Happy New Year" text, but this can be easily changed)
% !TEX encoding = UTF-8 Unicode
% !TEX TS-program = XeLaTeX
\documentclass[10pt]{standalone}
\usepackage{fontspec}
\usepackage{xeCJK}
\usepackage{xcolor} %To use the colors
\usepackage{tikz}
\usetikzlibrary{lindenmayersystems}
\usetikzlibrary{decorations.text,math} % math library to evaluate the color transition (key evaluate on tikz)
\definecolor{chinesegolden}{RGB}{%
246,180,72}
\definecolor{chinesered}{RGB}{%
198, 0, 20}
\begin{document}
\pgfdeclarelindenmayersystem{Hilbert curve}{
\symbol{X}{\pgflsystemdrawforward}
\symbol{+}{\pgflsystemturnright} % Explicitly define + and - symbols.
\symbol{-}{\pgflsystemturnleft}
\rule{A -> +BX-AXA-XB+}
\rule{B -> -AX+BXB+XA-}
}
\begin{tikzpicture}[
scale=2, decoration={
text effects along path,
text={ 新 年 快 乐 ! 新 年 快 乐 ! ! !},
text effects/.cd,
repeat text, %Fills the whole curve
character count=\i, character total=\n,
characters={evaluate={\c=\i/\n*100;},
scale=0.3,
text along path,
text ={chinesered!\c!chinesegolden}
}
}
]
\path[
decorate, %text effects={group letters},
lindenmayer system={
Hilbert curve, axiom=A, order = 5, angle=90 %Order 5 takes a while to render
},
]
lindenmayer system;
\end{tikzpicture}
\end{document}