I wanted to do add some graphics to a document in a way that are rotated randomly. For this this purpose I tried the following code
\documentclass[ngerman,german,14pt,twoside,openany]{scrbook}
\usepackage[left=2.5cm,right=2.5cm,top=2cm,bottom=2.5cm]{geometry}
\usepackage[ngerman]{babel}
\usepackage[utf8x]{inputenc}
\usepackage{rotating, graphicx}
\usepackage{graphicx}
\usepackage{tikz}
\usepackage{tikz-timing}
%https://texblog.org/2011/04/19/latex-pseudo-random-number-generator/
\usepackage[first=-5, last=5]{lcg}
\newcommand{\random}{\rand\arabic{rand}}
\begin{document}
\random\\
\random\\
\random
\begin{figure}
\centering
\includegraphics[width=4cm,angle=2]{image.jpg}%
\end{figure}
\begin{figure}
\centering
\includegraphics[width=4cm,angle=-7]{image2.jpg}%
\end{figure}
\end{document}
The generation of the random numbers as well the placement of the figures each for itself works flawlessly but when I try to combine these two codes, i.e. angle=\random
the compilation did not succeed. Any ideas how to solve this problem please?
utf8x
with recent TeX Live versions, it breaks more than it helps, LaTeX defaults toutf8
support since a few years now, and implements it in a more robust way thanutf8x
.\rand
is not expandable. If you do\rand\includegraphics[width=4cm,angle=\arabic{rand}]{image.jpg}
it should work.