Is there any reference of symbols including spinner (any shape) for latex document?
e.g. ;
The fontawesome package has a command \faSpinner producing this symbol:
You can find it, along with lots of other symbols, in the large symbols-a4.pdf.
Not a very practical solution, but I'm on a vacation and I was bored. :-) I attempted to draw the waiting symbol with TikZ. Here's the result:
\documentclass{article}
\usepackage{scalerel}
\usepackage{tikz}
\definecolorseries{graygrad}{rgb}{last}{white}{black}
\usetikzlibrary{calc}
\newcommand{\waiting}{%
\scalerel*{%
\begin{tikzpicture}
\coordinate (n-0) at (0,0) {};
\pgfmathtruncatemacro\maxcount{100}% Change this if necessary, larger numbers for smoother gradient, but longer compiling time.
\resetcolorseries[\maxcount]{graygrad}%
\pgfmathsetmacro\stepa{315/\maxcount}% 45deg to -270deg
\foreach \ii in {0,...,\numexpr\maxcount-1}{%
\pgfmathtruncatemacro\hi{\ii+1}%
\draw[draw=graygrad!!\ii, double distance=1cm, line cap=round, double=graygrad!!+] (n-\ii) arc [start angle=45-\ii*\stepa, end angle=45-\hi*\stepa, radius=2.5cm] node (n-\hi) {};
}
\end{tikzpicture}%
}{X}%
}
\begin{document}
This is my waiting symbol: \waiting\par
\Huge This is my waiting symbol \waiting.
\end{document}
In my code, there is a quantity \maxcount which you can change to vary the 'resolution' of the gray gradient in the symbol. At a count of 100, it takes around 2-3 seconds to compile, so it's not very efficient. If the number is too small, then the gradient will appear 'jagged' and not smooth.
Note that I also used the command from the scalerel package to scale the symbol down for in-line use. You can remove it and use a resizebox etc. if you need it at any other size.
The inevitable example of an animated spinner, based on Troy's code (A-Reader or Foxit required). The xsavebox package is used to save some final PDF file size.
\documentclass{article}
\usepackage{tikz}
\definecolorseries{graygrad}{rgb}{last}{white}{black}
\usetikzlibrary{calc}
\usepackage{amssymb}
\usepackage{xsavebox}
\usepackage{scalerel}
\usepackage{animate}
\newcommand{\waiting}{%
\begin{tikzpicture}
\coordinate (n-0) at (0,0) {};
\pgfmathtruncatemacro\maxcount{100}% Change this if necessary, larger numbers for smoother gradient, but longer compiling time.
\resetcolorseries[\maxcount]{graygrad}%
\pgfmathsetmacro\stepa{315/\maxcount}% 45deg to -270deg
\foreach \ii in {0,...,\numexpr\maxcount-1}{%
\pgfmathtruncatemacro\hi{\ii+1}%
\draw[draw=graygrad!!\ii, double distance=1cm, line cap=round, double=graygrad!!+] (n-\ii) arc [start angle=45-\ii*\stepa, end angle=45-\hi*\stepa, radius=2.5cm] node (n-\hi) {};
}
\end{tikzpicture}%
}
\newlength\myWidth
\begin{document}\Huge
\xsbox{Waiting}{\waiting}%
\settowidth\myWidth{\scalerel*{\theWaiting}{X}}%
%
This is my waiting symbol:
\begin{animateinline}[autoplay]{24}
\multiframe{80}{iAng=0+-15}{
\hbox to \myWidth{\hss\vbox to \myWidth{\vss\hbox{%
\rotatebox{\iAng}{\scalerel*{\theWaiting}{X}}%
}\vss}\hss}
}
\newframe
\hbox to \myWidth{\hss\vbox to \myWidth{\vss\hbox{%
\huge$\checkmark$%
}\vss}\hss}
\end{animateinline}.
\end{document}
\begin{animateinline} in a table cell?
Thank you!
– Shivid
May 22 '17 at 16:18
waiting is finished I'd like to have a word or a number, when I try to put it under \newframe, becomes like a stretched word. Thanks again
– Shivid
May 23 '17 at 18:48
: )– Shivid May 12 '17 at 14:43\maxcountfurther so it's not so taxing during compilation. Cheers! – Troy May 12 '17 at 15:01\xsavebox(pkg of the same name).Then it is typeset only once. – AlexG May 20 '17 at 18:03saveboxpackage documentation, but I can't seem to figure out how to use it in this case. Considering I'm drawing arcs with different start and end angles in each loop, and each arc should have a different colour (consecutive steps in a colour series) – Troy May 21 '17 at 03:03xsaveboxwould accelerate the compilation. But after running tests myself, I found out that the gain of time is not that significant; a standard\saveboxwould do as well. However, the reduction of PDF file size is worth noting. – AlexG May 22 '17 at 07:50xsaveboxpackage documentation. In either case, I'm not so sure about how to implement/integrate\savebox/\xsaveboxinto my code. I'll be agreeable to an addition to my answer, if you would feel so inclined. (since you've already done the tests and all) :) – Troy May 22 '17 at 07:53\xsbox{Waiting}{\waiting}\scalerel*{\theWaiting}{X}\Huge\scalerel*{\theWaiting}{X}saves about 6kB as cmpd to\scalerel*{\waiting}{X}\Huge\scalerel*{\waiting}{X};-) . I added a community wiki answer with an animation example. – AlexG May 22 '17 at 08:40