tikz绘制表格最后一行对不齐

2019-12-18 11:44发布

```tex \documentclass[8pt]{extarticle} \usepackage[UTF8]{ctex} \usepackage[paperwidth=21cm,paperheig...

```tex \documentclass[8pt]{extarticle} \usepackage[UTF8]{ctex} \usepackage[paperwidth=21cm,paperheight=29.7cm,top=2.4cm,bottom=2.4cm,right=0.78cm,left=1.78cm]{geometry} \usepackage{fancyhdr} \usepackage{tikz} \setlength{\linewidth}{18.44cm} \makeatletter \newlength{\blk@height} \newlength{\blk@width} \newlength{\blk@cell@ht} \newlength{\blk@cell@dp} \newlength{\blk@cell@total} \newlength{\blk@cell@wd} \setlength{\blk@height}{\dimexpr\pagegoal-\pagetotal\relax} \setlength{\blk@width}{\linewidth} \setlength{\blk@cell@ht}{26pt} \setlength{\blk@cell@dp}{4pt} \setlength{\blk@cell@total}{\dimexpr\blk@cell@ht + \blk@cell@dp\relax} \setlength{\blk@cell@wd}{26pt} %\pgfmathsetmacro{\rowCount}{floor(\blk@height / \blk@cell@total) - 1} \newcommand{\drawBlocks}[1]{% \def\rowCount{#1}% \pgfmathsetmacro{\colCount}{floor(\blk@width / \blk@cell@wd)}% \vspace{\dimexpr\blk@cell@dp-\lineskip\relax} \foreach \y in {0, ..., \rowCount} { \begin{tikzpicture} \draw (0, \y * -\blk@cell@total) -- +(\blk@cell@wd * \colCount, 0) ++(0, -\blk@cell@ht) -- +(\blk@cell@wd * \colCount, 0); \foreach \x in {0, ..., \colCount} { \draw (\x * \blk@cell@wd, \y * -\blk@cell@total) -- +(0pt, -\blk@cell@ht); } \end{tikzpicture} \vspace{\dimexpr\blk@cell@dp-\lineskip\relax} }% } \makeatother \pagestyle{fancy} \renewcommand{\headrulewidth}{0pt} \renewcommand{\footrulewidth}{0pt} \begin{document} \noindent 12.写作表达\quad\\[0pt]从下面两题中任选一题,按要求完成任务。\quad\\[0pt]\indent \textbf{题一:开在心中的花朵}\quad\\[0pt]\indent \textbf{题二:我最想感谢的人}\quad\\[0pt]\indent 要求:\textcircled{1}不少于600字;\textcircled{2}书写工整,语句通顺,勿写错别字;\textcircled{3}有事例,有真情实感。\quad\\[0pt] \quad\\[0pt] \drawBlocks{40} %\colCount \end{document} ``` ![](https://pics.latexstudio.net/data/images/201912/f5b45fc24cf1cef.png)