我在回忆录类中没有获得自定义页面大小。出了什么问题?

我在回忆录类中没有获得自定义页面大小。出了什么问题?
\documentclass{memoir}
\usepackage[pageheight= 94mm, pagewidth=195mm]{geometry}
\stockwidth\paperwidth
\stockheight\paperheight
\usepackage{tikz}
\usepackage[utf8]{inputenc}
\newcommand\PlaceText[3]{%
\begin{tikzpicture}[remember picture,overlay]
\node[outer sep=0pt,inner sep=0pt,anchor=south west] 
  at ([xshift=#1,yshift=-#2]current page.north west) {#3};
\end{tikzpicture}%
}

%%number to words
\newcommand\majorUnit{Rupees}
\newcommand\minorUnit{Paisa}
\newcommand\spellOutCurrency[2]{%
    \NumToName{#1}\,\majorUnit\ and \NumToName{#2}\,\minorUnit%
}
% Load data from csv 
\usepackage{datatool}
\begin{filecontents*}{data.csv}
Name, Amount 
John Doe, 1250
Tin Tin, 159

\end{filecontents*}




% Use custom date format
\usepackage{datetime,calc,tokcycle}
\Characterdirective{\addcytoks{#1\ }}
\newcommand{\customtoday}{\expandedtokcyclexpress
  {\twodigit{\the\day}\twodigit{\the\month}\the\year}\the\cytoks\unskip}
  
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

\begin{document}
% Load data.csv 
\DTLloaddb{list}{data.csv}
\DTLforeach{list}{%
\Name=Name,\Amount=Amount}

{\newpage

\thispagestyle{plain}
\PlaceText{15 cm}{0.75 cm}{ \customtoday}
\PlaceText{ 2 cm }{ 2 cm }{\Name }
\PlaceText{2 cm }{3.5 cm}{\spellOutCurrency{\Amount}{00}}
\PlaceText{15 cm}{3.8cm}{\Amount/-only}
}
\end{document}

我无法生成自定义页面尺寸来打印银行支票。这段代码有什么问题?

答案1

您的代码有两个问题。首先,中没有pageheightandpagewidth选项geometry;您需要使用paperheightand paperwidth。其次,您需要将\newpage命令放在执行块的末尾,而不是开头。\pagestyle{plain}与 相比,使用 似乎也有点奇怪{empty},但这取决于您是否真正想要像这样对支票进行编号。

\documentclass{memoir}
\usepackage[paperheight= 94mm, paperwidth=195mm]{geometry}
\stockwidth\paperwidth
\stockheight\paperheight
\usepackage{tikz}
\usepackage[utf8]{inputenc}
\newcommand\PlaceText[3]{%
\begin{tikzpicture}[remember picture,overlay]
\node[outer sep=0pt,inner sep=0pt,anchor=south west] 
  at ([xshift=#1,yshift=-#2]current page.north west) {#3};
\end{tikzpicture}%
}

%%number to words
\newcommand\majorUnit{Rupees}
\newcommand\minorUnit{Paisa}
\newcommand\spellOutCurrency[2]{%
    \NumToName{#1}\,\majorUnit\ and \NumToName{#2}\,\minorUnit%
}
% Load data from csv 
\usepackage{datatool}
\begin{filecontents*}{data.csv}
Name, Amount 
John Doe, 1250
Tin Tin, 159

\end{filecontents*}




% Use custom date format
\usepackage{datetime,calc,tokcycle}
\Characterdirective{\addcytoks{#1\ }}
\newcommand{\customtoday}{\expandedtokcyclexpress
  {\twodigit{\the\day}\twodigit{\the\month}\the\year}\the\cytoks\unskip}
  
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

\begin{document}
% Load data.csv 
\DTLloaddb{list}{data.csv}
\DTLforeach*{list}{%
\Name=Name,\Amount=Amount}
{\thispagestyle{plain}
\PlaceText{15 cm}{0.75 cm}{ \customtoday}
\PlaceText{ 2 cm }{ 2 cm }{\Name }
\PlaceText{2 cm }{3.5 cm}{\spellOutCurrency{\Amount}{00}}
\PlaceText{15 cm}{3.8cm}{\Amount/-only}
\newpage}
\end{document}

代码输出

相关内容