# LuaLaTeX error when compiling visual counter [closed]

I asked a question about visual counters in beamer, for which I got this answer. Now I need to compile it by LuaLaTeX in order to use the package luapersian(below code), but it returns some errors.

‎\documentclass{beamer}‎
‎\usepackage{lmodern}‎
‎\usepackage{tikz}‎
‎\usetikzlibrary{calc}‎

‎\pgfkeys{/visual counter/.cd‎,
‎thickness/.store in=\thickness‎,
‎thickness=0.4ex‎,
‎segment distance/.store in=\segdist‎,
‎segment distance=8‎,
‎color current frame/.store in=\colcurrframe‎,
‎color current frame=orange‎,
‎color old frame/.store in=\cololdframe‎,
‎color old frame=blue‎,
‎color next frame/.store in=\colnextframe‎,
‎color next frame=gray!30‎,
‎color page number/.store in=\colpagenum‎,
‎color page number=white‎,
‎current value/.store in=\currentv‎,
‎current value=1‎,
‎total value/.store in=\totalv‎,
‎total value=2‎,
‎circled page number/.code={‎
‎\begin{tikzpicture}[fill color/.style={}]‎
‎\pgfkeys{/visual counter/.cd‎,
}
‎\pgfmathtruncatemacro\current{\currentv+1}‎
‎\def\tot{\totalv}‎

‎\foreach \s in {1,...,\tot}‎
{
‎\ifnum\s>\current%‎
‎\tikzset{fill color/.append style={\colnextframe}}%‎
‎\fi%‎
‎\ifnum\s=\current%‎
‎\tikzset{fill color/.append style={\colcurrframe}}%‎
‎\fi%‎
‎\ifnum\s<\current%‎
‎\tikzset{fill color/.append style={\cololdframe}}%‎
‎\fi%‎
‎\fill[fill color]‎
‎({90-360/\tot * (\s‎ - ‎1)-\segdist}:\radiusout) arc‎
‎({90-360/\tot * (\s‎ - ‎1)-\segdist}:{90-360/\tot * (\s)+\segdist}:\radiusout)‎ --
‎({90-360/\tot * (\s)+\segdist}:{90-360/\tot * (\s‎ - ‎1)-\segdist}:\radiusin);‎
}
‎\end{tikzpicture}‎
‎}‎,
}

% ‎new footline with‎
‎\setbeamertemplate{footline}{‎
‎\begin{beamercolorbox}[wd=0.95\textwidth‎, ‎ht=2ex,dp=1ex,sep=1ex]{footline}‎
‎\hfill%‎
‎\tikz\node[/visual counter/.cd‎,
‎segment distance=-2pt‎,
‎color old frame=orange!50‎,
‎color current frame=cyan!80!gray!50‎,
‎color next frame=cyan!80!gray!50‎,
‎circled page number‎,
‎]{};‎
‎\end{beamercolorbox}‎
}‎

‎\usepackage{luapersian}‎

‎\begin{document}‎

‎\begin{frame}

‎\end{frame}‎

‎\end{document}‎


## closed as unclear what you're asking by user36296, Stefan Pinnow, Jesse, Martin Schröder, Au101Jun 12 '17 at 15:15

Please clarify your specific problem or add additional details to highlight exactly what you need. As it's currently written, it’s hard to tell exactly what you're asking. See the How to Ask page for help clarifying this question. If this question can be reworded to fit the rules in the help center, please edit the question.

• Please give us some code. I don't use Persian and don't want to find out how to do that in LaTeX just in order to help here with some compilation issue. And what are the errors? – LaRiFaRi Apr 15 '14 at 15:21
• Yes, please, edit your post and include all the relevant TeX codes, otherwise we are wildly guessing what might go wrong. – Malipivo Apr 15 '14 at 16:20
• Welcome to TeX.SX! Please help us to help you and add a minimal working example (MWE) that illustrates your problem. It will be much easier for us to reproduce your situation and find out what the issue is when we see compilable code, starting with \documentclass{...} and ending with \end{document}. – Martin Schröder Apr 16 '14 at 11:58
• I edited the post, please see again. – user49875 Apr 16 '14 at 13:25
• Your example document fails to compile (even without luapersian); something seems to be wrong. Does it compile for you as is (without loading luapersian)? – Gonzalo Medina Apr 16 '14 at 13:36

Caveat emptor I don't have \usepackage{luapersian}, so I only tried to compile with lualatex

Your visible code looks fine, but when copying from your question above there where tons of invisible characters in front of after the visible text. After removing all of them, you example compiles fine with lualatex

\documentclass{beamer}
\usepackage{lmodern}
\usepackage{tikz}
\usetikzlibrary{calc}

\pgfkeys{/visual counter/.cd,
thickness/.store in=\thickness,
thickness=0.4ex,
segment distance/.store in=\segdist,
segment distance=8,
color current frame/.store in=\colcurrframe,
color current frame=orange,
color old frame/.store in=\cololdframe,
color old frame=blue,
color next frame/.store in=\colnextframe,
color next frame=gray!30,
color page number/.store in=\colpagenum,
color page number=white,
current value/.store in=\currentv,
current value=1,
total value/.store in=\totalv,
total value=2,
circled page number/.code={
\begin{tikzpicture}[fill color/.style={}]
\pgfkeys{/visual counter/.cd,
}
\pgfmathtruncatemacro\current{\currentv+1}
\def\tot{\totalv}

\foreach \s in {1,...,\tot}
{
\ifnum\s>\current%
\tikzset{fill color/.append style={\colnextframe}}%
\fi%
\ifnum\s=\current%
\tikzset{fill color/.append style={\colcurrframe}}%
\fi%
\ifnum\s<\current%
\tikzset{fill color/.append style={\cololdframe}}%
\fi%
\fill[fill color]
({90-360/\tot * (\s - 1)-\segdist}:\radiusout) arc
({90-360/\tot * (\s - 1)-\segdist}:{90-360/\tot * (\s)+\segdist}:\radiusout) --
({90-360/\tot * (\s)+\segdist}:{90-360/\tot * (\s - 1)-\segdist}:\radiusin);
}
\end{tikzpicture}
},
}

% new footline with
\setbeamertemplate{footline}{
\begin{beamercolorbox}[wd=0.95\textwidth, ht=2ex,dp=1ex,sep=1ex]{footline}
\hfill%
\tikz\node[/visual counter/.cd,
segment distance=-2pt,
color old frame=orange!50,
color current frame=cyan!80!gray!50,
color next frame=cyan!80!gray!50,
circled page number,
]{};
\end{beamercolorbox}
}

%\usepackage{luapersian}

\begin{document}

\begin{frame}
abc
\end{frame}

\begin{frame}
abc
\end{frame}

\begin{frame}
abc
\end{frame}

\end{document}