西多会页码

西多会页码

我最近了解到西多会数字系统。我很喜欢它,想用它来给我的论文的页码。

使用 tikz 包,我可以使用自制命令(如 \cistercian{3751})绘制一个 4 位数字。想法是将页码(用零填充)传递给它,并将其以十进制形式绘制在页码旁边。但我似乎无法将页码传递给它。调用 \cistercianpagenumber 时,错误出现在第 74 行:

缺少字符:字体 nullfont 中没有 ;!!\XC@definec@lor 的参数有一个多余的 }。

根据我的研究,这可能是因为页码不应该作为参数传递,或者是其他什么原因,我在这里迷失了......

我把所有代码都放在下面。目前还不能在正确的位置绘制页码,但之后可以做到。在进入演示细节之前必须解决这个问题。

感谢您的帮助。

利奥

\documentclass[review]{article}

\usepackage{tikz}

\usepackage{ifthen}
\usepackage{xstring}
\usepackage{fmtcount}



\begin{document}

%Define macros for drawing every 0-9 numbers at unit place
\newcommand{\zero}{\draw[black, thick] (0,-0.5)--(0, 0.5)}
\newcommand{\one}{\draw[black, thick] (0,0.5)--(0.25, 0.5)}
\newcommand{\two}{\draw[black, thick] (0,0.25)--(0.25, 0.25)}
\newcommand{\three}{\draw[black, thick] (0,0.5)--(0.25, 0.25)}
\newcommand{\four}{\draw[black, thick] (0,0.25)--(0.25, 0.5)}
\newcommand{\five}{\one; \four;}
\newcommand{\six}{\draw[black, thick] (0.25,0.25)--(0.25, 0.5)}
\newcommand{\seven}{\one; \six;}
\newcommand{\eight}{\two; \six;}
\newcommand{\nine}{\one; \two; \six;}

%Define macros for drawing a number as a 1000, 100 or 10 digit place
\newcommand{\tens}[1]{\begin{scope}[yscale= 1,xscale=-1]; #1; \end{scope}}
\newcommand{\hundreds}[1]{\begin{scope}[yscale=-1]; #1; \end{scope}}
\newcommand{\thousands}[1]{\begin{scope}[yscale=-1,xscale=-1]; #1; \end{scope}}

%Draw the cistercian number using selfmade commands
\newcommand{\cistercianhard}[4]{%
\zero;%
#4;%
\tens{#3};%
\hundreds{#2};%
\thousands{#1};%
}

%From a number 0-9, returns the self made command corresponding to that number
\newcommand{\getnumber}[1]{%
\ifthenelse{\equal{#1}{0}}{\zero;}{}%
\ifthenelse{\equal{#1}{1}}{\one;}{}%
\ifthenelse{\equal{#1}{2}}{\two;}{}%
\ifthenelse{\equal{#1}{3}}{\three;}{}%
\ifthenelse{\equal{#1}{4}}{\four;}{}%
\ifthenelse{\equal{#1}{5}}{\five;}{}%
\ifthenelse{\equal{#1}{6}}{\six;}{}%
\ifthenelse{\equal{#1}{7}}{\seven;}{}%
\ifthenelse{\equal{#1}{8}}{\eight;}%
\ifthenelse{\equal{#1}{9}}{\nine;}%
}

%Draw Cistercian number from a 4 digit number
\newcommand{\cistercian}[1]{%
\zero;%
\StrChar{#1}{1}[\thou];%
\StrChar{#1}{2}[\hund];%
\StrChar{#1}{3}[\tens];%
\StrChar{#1}{4}[\unit];%
\thousands{\getnumber{\thou}};%
\hundreds{\getnumber{\hund}};%
\tens{\getnumber{\tens}};%
\getnumber{\unit};%
}

%Draw the Page number in Cistercian numerals
\newcommand{\cistercianpagenumber}{%
\begin{tikzpicture}%
\cistercian{\padzeroes[4]{\decimal{page}}};%
\end{tikzpicture}%
}

%Test of the last macro
\cistercianpagenumber

\end{document}

答案1

我更喜欢使用 的实现expl3,它与 Ti 的混合有点复杂Z。

\documentclass{article}

\usepackage{tikz}
%\usepackage{xparse} % not needed for LaTeX 2020-10-01 or later

%Define macros for drawing every 0-9 numbers at unit place
\NewDocumentCommand{\cistercianzero}{}{\draw[black, thick] (0,-0.5)--(0, 0.5)}
\NewDocumentCommand{\cistercianone}{}{\draw[black, thick] (0,0.5)--(0.25, 0.5)}
\NewDocumentCommand{\cisterciantwo}{}{\draw[black, thick] (0,0.25)--(0.25, 0.25)}
\NewDocumentCommand{\cistercianthree}{}{\draw[black, thick] (0,0.5)--(0.25, 0.25)}
\NewDocumentCommand{\cistercianfour}{}{\draw[black, thick] (0,0.25)--(0.25, 0.5)}
\NewDocumentCommand{\cistercianfive}{}{\cistercianone; \cistercianfour;}
\NewDocumentCommand{\cisterciansix}{}{\draw[black, thick] (0.25,0.25)--(0.25, 0.5)}
\NewDocumentCommand{\cistercianseven}{}{\cistercianone; \cisterciansix;}
\NewDocumentCommand{\cistercianeight}{}{\cisterciantwo; \cisterciansix;}
\NewDocumentCommand{\cisterciannine}{}{\cistercianone; \cisterciantwo; \cisterciansix;}

\NewDocumentCommand{\cisterciandigit}{mmm}{%
  % #1 = xscale, #2 = yscale, #3 = digit
  \begin{scope}[xscale=#1,yscale=#2] #3; \end{scope}%
}
% units: {1}{1}{digit}
% tens: {-1}{1}{digit}
% hundreds: {1}{-1}{digit}
% thousands: {-1}{-1}{digit

\ExplSyntaxOn
\NewDocumentCommand{\cistercian}{O{1}m}
 {% force digits; #1 is the optional scale
  \azireo_cistercian:ne { #1 } { \int_to_arabic:n { #2 } }
 }
\cs_new_protected:Nn \azireo_cistercian:nn
 {% pad to four digits
  \__azireo_cistercian_split:ne { #1 } { \prg_replicate:nn {4-\tl_count:n{#2}}{0} #2 }
 }
\cs_generate_variant:Nn \azireo_cistercian:nn { ne }

\cs_new_protected:Nn \__azireo_cistercian_split:nn
 {% gather the digits
  \__azireo_cistercian_split:nNNNN { #1 } #2
 }
\cs_generate_variant:Nn \__azireo_cistercian_split:nn { ne }

\cs_new_protected:Nn \__azireo_cistercian_split:nNNNN
 {% the digit are used in reverse
  \__azireo_cistercian_print:nnnnn { #1 }
   { \azireo_cistercian_digit:n { #5 } }
   { \azireo_cistercian_digit:n { #4 } }
   { \azireo_cistercian_digit:n { #3 } }
   { \azireo_cistercian_digit:n { #2 } }
 }
\cs_new_protected:Nn \azireo_cistercian_digit:n
 {% choose the representation for the digit
  \int_case:nn { #1 }
   {
    %{0}{\cistercianzero} % the base is already present, no need to repeat it
    {1}{\cistercianone}
    {2}{\cisterciantwo}
    {3}{\cistercianthree}
    {4}{\cistercianfour}
    {5}{\cistercianfive}
    {6}{\cisterciansix}
    {7}{\cistercianseven}
    {8}{\cistercianeight}
    {9}{\cisterciannine}
   }
 }
\cs_new_protected:Nn \__azireo_cistercian_print:nnnnn
 {
  \begin{tikzpicture}[scale=#1]
  \cistercianzero;              % base
  \cisterciandigit{ 1}{ 1}{#2}; % units
  \cisterciandigit{-1}{ 1}{#3}; % tens
  \cisterciandigit{ 1}{-1}{#4}; % hundreds
  \cisterciandigit{-1}{-1}{#5}; % thousands
  \end{tikzpicture}
 }

\ExplSyntaxOff

\renewcommand{\thepage}{\cistercian{\arabic{page}}} % this will print page numbers in Cistercian numerals

\begin{document}

Page: \cistercian{\arabic{page}}

347: \cistercian{347}

1234: \cistercian{1234}

\ExplSyntaxOn
From~1~to~100:~\int_step_inline:nn { 100 } { \cistercian[0.5]{#1}~ }
\ExplSyntaxOff

\end{document}

在此处输入图片描述

做好论文被拒绝的准备吧。;-)

答案2

我最近根据 @egreg 提供的答案在自己的论文中实现了这一点。但是,我意识到引用特定页面对大多数人来说会很麻烦。因此,我以一种每页都有两个不同数字的方式实现了它。我在右上/左上角有阿拉伯数字(用于奇数/偶数页)(根据对这篇文章的回答) 和西多会数字,位于每页的底部中央。

相关代码部分如下:

%% Define the packages needed
\usepackage{tikz}
\usepackage{xparse} % not needed for LaTeX 2020-10-01 or later

%Define macros for drawing every 0-9 numbers at unit place
\NewDocumentCommand{\cistercianzero}{}{\draw[black, thick] (0,-0.5)--(0, 0.5)}
\NewDocumentCommand{\cistercianone}{}{\draw[black, thick] (0,0.5)--(0.25, 0.5)}
\NewDocumentCommand{\cisterciantwo}{}{\draw[black, thick] (0,0.25)--(0.25, 0.25)}
\NewDocumentCommand{\cistercianthree}{}{\draw[black, thick] (0,0.5)--(0.25, 0.25)}
\NewDocumentCommand{\cistercianfour}{}{\draw[black, thick] (0,0.25)--(0.25, 0.5)}
\NewDocumentCommand{\cistercianfive}{}{\cistercianone; \cistercianfour;}
\NewDocumentCommand{\cisterciansix}{}{\draw[black, thick] (0.25,0.25)--(0.25, 0.5)}
\NewDocumentCommand{\cistercianseven}{}{\cistercianone; \cisterciansix;}
\NewDocumentCommand{\cistercianeight}{}{\cisterciantwo; \cisterciansix;}
\NewDocumentCommand{\cisterciannine}{}{\cistercianone; \cisterciantwo; \cisterciansix;}

\NewDocumentCommand{\cisterciandigit}{mmm}{%
  % #1 = xscale, #2 = yscale, #3 = digit
  \begin{scope}[xscale=#1,yscale=#2] #3; \end{scope}%
}
% units: {1}{1}{digit}
% tens: {-1}{1}{digit}
% hundreds: {1}{-1}{digit}
% thousands: {-1}{-1}{digit

%% Define the new syntax
\ExplSyntaxOn
\NewDocumentCommand{\cistercian}{O{1}m}
 {% force digits; #1 is the optional scale
  \azireo_cistercian:ne { #1 } { \int_to_arabic:n { #2 } }
 }
\cs_new_protected:Nn \azireo_cistercian:nn
 {% pad to four digits
  \__azireo_cistercian_split:ne { #1 } { \prg_replicate:nn {4-\tl_count:n{#2}}{0} #2 }
 }
\cs_generate_variant:Nn \azireo_cistercian:nn { ne }

\cs_new_protected:Nn \__azireo_cistercian_split:nn
 {% gather the digits
  \__azireo_cistercian_split:nNNNN { #1 } #2
 }
\cs_generate_variant:Nn \__azireo_cistercian_split:nn { ne }

\cs_new_protected:Nn \__azireo_cistercian_split:nNNNN
 {% the digit are used in reverse
  \__azireo_cistercian_print:nnnnn { #1 }
   { \azireo_cistercian_digit:n { #5 } }
   { \azireo_cistercian_digit:n { #4 } }
   { \azireo_cistercian_digit:n { #3 } }
   { \azireo_cistercian_digit:n { #2 } }
 }
\cs_new_protected:Nn \azireo_cistercian_digit:n
 {% choose the representation for the digit
  \int_case:nn { #1 }
   {
    %{0}{\cistercianzero} % the base is already present, no need to repeat it
    {1}{\cistercianone}
    {2}{\cisterciantwo}
    {3}{\cistercianthree}
    {4}{\cistercianfour}
    {5}{\cistercianfive}
    {6}{\cisterciansix}
    {7}{\cistercianseven}
    {8}{\cistercianeight}
    {9}{\cisterciannine}
   }
 }
\cs_new_protected:Nn \__azireo_cistercian_print:nnnnn
 {
  \begin{tikzpicture}[scale=#1]
  \cistercianzero;              % base
  \cisterciandigit{ 1}{ 1}{#2}; % units
  \cisterciandigit{-1}{ 1}{#3}; % tens
  \cisterciandigit{ 1}{-1}{#4}; % hundreds
  \cisterciandigit{-1}{-1}{#5}; % thousands
  \end{tikzpicture}
 }
\ExplSyntaxOff

%% Define a new counter for the pages
\newcounter{chappage}[chapter]% chappage is slave to chapter
\renewcommand{\thechappage}{\stepcounter{chappage}\arabic{chappage}}

\usepackage{fancyhdr}% http://ctan.org/pkg/fancyhdr
\fancypagestyle{plain}{% 'plain' page style (used for first page of chapter)
  \fancyhf{}% clear all header and footer fields
  \renewcommand{\headrulewidth}{0pt}% no header rule
  \renewcommand{\footrulewidth}{0pt}% footer rule
  \fancyhead[RO]{\thechapter-\thechappage}% 
  %\fancyhead[LE,RO]{\thechapter-\thechappage}% 
  \fancyfoot[C]{\cistercian{\thepage}}
  %\fancyfoot[C]{\thepage}
}
% Regular 'fancy' page style
\fancyhf{}% clear all header and footer fields
\fancyhead[LE,RO]{\thechapter-\thechappage}
\fancyfoot[C]{\cistercian{\thepage}}
%\fancyfoot[C]{\thepage}
\renewcommand{\headrulewidth}{0.1pt}% header rule
\renewcommand{\footrulewidth}{0pt}% footer rule
\pagestyle{fancy}

如果您在之前复制并粘贴此部分\begin{document},它可以正常工作。

答案3

您可以使用该xistercian包:

\documentclass{article}

\usepackage{xistercian}
\pagenumbering{cistercian}

\usepackage{duckuments}

\begin{document}
Nice numbers: \cisterciannum{357} or \cisterciannum{123456789}.

\duckument
\end{document}

在此处输入图片描述

答案4

使用cistercian软件包(尚未在 ctan 上提供,但可在 github 上获取)https://github.com/samcarter/cistercian

\documentclass{article}

\usepackage{cistercian}

\renewcommand{\thepage}{\cistercian[scale=2]{\value{page}}}

\begin{document}

\cistercian{314}

\end{document}

(如果您想要快速解决方案,请使用xistercian

相关内容