\documentclass[a4paper]{article} \usepackage{xcolor} % fixes \fbox \pagestyle{empty} % no page number \setlength{\topskip}{0pt} % we do not have text lines \setlength{\maxdepth}{0pt} \setlength{\fboxsep}{0pt} \newlength{\cellunit} \newlength{\cellsep} %%% configuration begin %%% \setlength{\fboxrule}{.8pt} % line width of the frame lines \setlength{\cellunit}{13mm} % width and height of the cell excluding frame \newcommand*{\hnum}{10} % number of cells, horizontal direction \newcommand*{\vnum}{20} % number of cells, vertical direction \color[RGB]{50,100,200} %%% configuration end %%% \newcommand*{\cell}{% \fbox{% \rule{0pt}{\cellunit}% \rule{\cellunit}{0pt}% }% } % calculate the vertical margin \fboxrule=2\dimexpr.5\fboxrule\relax % even sp number \newlength{\margin} \margin=.5\dimexpr\paperheight-\vnum\cellunit-\vnum\fboxrule-\fboxrule\relax \ifdim\margin<0pt \errmessage{Cell dimensions or cell numbers are too large for the page}% \fi % set equal margins everywhere \usepackage[margin=\margin]{geometry} \begin{document} \vbox to \textheight{% \kern.5\fboxrule \cleaders\vbox{% \kern-.5\fboxrule \hbox to \textwidth{% \cellsep=\dimexpr( \textwidth-\hnum\dimexpr\cellunit+2\fboxrule\relax )/\numexpr\hnum-1\relax\relax \kern-.5\cellsep \xleaders\hbox{% \kern.5\cellsep \cell \kern.5\cellsep }\hskip\dimexpr\textwidth+\cellsep\relax \kern-.5\cellsep }% \kern-.5\fboxrule }\vskip\dimexpr\textheight-\fboxrule\relax \kern.5\fboxrule }% \end{document}
\cellunit
: 单元格的宽度与高度\fboxrule
: 格子的线宽度\hnum
: 橫向的格子数量\vnum
: 竖向的格子数量也可以设置颜色
纸张的尺寸
另外,可以使用pstricks来进行绘制。
\documentclass[pstricks]{standalone} \usepackage{fp} % user defined macros \FPeval\Width{21.0} % paper width \FPeval\Height{29.7} % paper height \FPeval\HM{1} % horizontal margin \FPeval\Gap{0.7} % column gap \FPeval\M{10} % number of columns % auxiliary macros \FPeval\Side{round((Width-Gap*(M-1)-2*HM)/M:2)} \FPeval\N{round((Height-2*HM)/Side:0)} \FPeval\VM{round((Height-N*Side)/2:2)} \SpecialCoor \begin{document} \begin{pspicture}[showgrid=false](\Width,-\Height) \multips(0,0)(0,-\Side){\N}{\multips(\HM,-\VM)(!\Side\space \Gap\space add 0){\M}{\psframe[dimen=middle](0,0)(\Side,-\Side)}} \end{pspicture} \end{document}
当然,tikz也是非常试用的。
\documentclass{article} \usepackage[paper=a4paper, showframe=true]{geometry} \usepackage{etoolbox} \usepackage{tikz} \usetikzlibrary{matrix} \begin{document} \let\mymatrixcontent\empty \newcommand{\row}{% \foreach \j in {1,...,25}{ \foreach \i in {1,...,10} {% \begingroup\edef\x{\endgroup \noexpand\gappto\noexpand\mymatrixcontent{ {}\&}}\x }% \gappto\mymatrixcontent{\\}% } } \row \begin{tikzpicture} \tikzset{every node/.style={minimum size=8mm}, pre/.style={draw}} \matrix (a) [ampersand replacement=\&,matrix of math nodes, nodes={pre},column sep=6mm]{ \mymatrixcontent }; \end{tikzpicture} \end{document}
详情可以参考如下链接。 选自:http://tex.stackexchange.com/questions/82611/how-do-i-go-about-typesetting-a-genkou-youshi-page
发表评论 取消回复