sorry I attach Lua version. see below.
From other source, I learned that fancyhdr is a
grouped environment and as soon as Lua code exit
all information get lost.
So I modified the code to start group and complete and
the code is working as I expected. I will post working sample
as it is ready. Thank you.

-------------------- lua version begin ---------------------

\documentclass{article}
\usepackage{calc}
\usepackage{color}
\usepackage{enumitem}
\usepackage{fancyhdr}
\usepackage{fancyvrb}
\usepackage{hyperref}
\usepackage{ifthen}
\usepackage{listings}
\usepackage{luacode}
\usepackage{luatexko}
\usepackage{pgf}
\usepackage{tikz}
\usepackage[paper=A3,pagesize]{typearea}

\begin{document}

\pagestyle{fancy}

\begin{luacode*}
        tex.print([[ \fancypagestyle{mystyleeight}{ ]])
        tex.print([[ \fancyfoot[C]{mystyle-eight \thepage} ]])
        tex.print([[ } ]])
        tex.print([[ \fancypagestyle{mystylethree}{ ]])
        tex.print([[ \fancyfoot[C]{mystyle-three \thepage} ]])
        tex.print([[ } ]])
\end{luacode*}

\pagestyle{mystyleeight}
page should be mystlye-eight

\newpage
\pagestyle{mystylethree}
page should be mystlye-three

\newpage
\pagestyle{mystyleeight}
page should be mystlye-eight

\end{document}

-------------------- lua version end ---------------------

Reply via email to