我想要一个针对“字母”的功能。我所说的字母是指一张有横线的纸张,并且文本看起来是对齐的,就像没有“uline”功能一样。
此外,该ulem
包不是我想要的,因为最后一行总是很短(任何有换行符的行)。
我更多地考虑的是考试课上的一些事情,以及秩序\fillwithlines
。
有人有主意吗?提前谢谢!
\documentclass[fontsize=9pt,twoside, DIV=calc]{scrbook}
\usepackage[papersize={12.5cm,19cm},inner=10mm, outer=10mm, bottom=13mm, top=10mm, footskip=6mm]{geometry}
\usepackage[T1]{fontenc}
\usepackage[utf8]{inputenc}
\usepackage[ngerman]{babel}
\usepackage[]{lipsum}
\usepackage{xcolor}
\xdefinecolor{notiz}{RGB}{239,227,157}
\usepackage{tabularx}
\usepackage{tikz}
\usepackage{tikzsymbols}
\usepackage{varwidth}
\usetikzlibrary{shapes}
\usetikzlibrary{decorations.pathmorphing}
\usepackage{ulem}
\newcommand{\post}[1]{
\small
\begin{center}
\begin{tikzpicture}[pencildraw/.style={ %
decorate,
decoration={random steps,segment length=2pt,amplitude=1pt}
} %
]
\node[ preaction={fill=black,opacity=.5,% zeilenabstand=2.8,
transform canvas={xshift=1mm,yshift=-1mm}},
pencildraw,draw,fill=notiz,text width=.8\textwidth,
inner sep=5mm] {\uline{#1}};
\end{tikzpicture}
\end{center}
\normalsize
}
\begin{document}
\post{\lipsum[1]}
\end{document}
答案1
找到合适的横格纸,例如http://www.wordmstemplates.com/wp-content/uploads/2015/08/lined-paper-template-9898.jpg,下载图像并使用它作为\includegraphics
文件名。
带格文本框
这里我介绍的\linedbox{<width>}{<content>}
是不支持分页的。用户参数显示在MWE的顶部:
\addedleftmargin
带线框的左边距(当前为 20pt);\addedrightmargin
带线框的右边距(当前为 20pt);\scaledheight
缩放后的纸张高度。用于使纸张的规则间距与字体大小相匹配(当前为 6.98 英寸);\scaledwidth
缩放后的纸张宽度。它至少应与您想要制作的最宽框一样大(其值将影响红线的视宽度和左边距大小)(当前\textwidth
);\naturalindent
缩放纸张的自然左缩进,通常到红线右侧的某个点(目前为 的 15%\scaledwidth
)。\topdiscard
要丢弃的缩放图像顶部无格线纸张的数量(目前为 的 10%\scaledheight
);以及\topbottomgap
在标尺框上方和下方添加垂直间隙(当前为 1pt)。
这是 MWE
\documentclass{article}
\usepackage{graphicx,stackengine,trimclip}
\usepackage{lipsum}
\def\addedleftmargin{20pt}% LEFT MARGIN OF RULED BOX
\def\addedrightmargin{20pt}% RIGHT MARGIN OF RULED BOX
\def\scaledheight{6.98in}% ADJUST FOR DIFFERENT FONT SIZES
\def\scaledwidth{\textwidth}% SHOULD BE SET AT LEAST AS WIDE AS WIDEST USAGE
\def\naturalindent{.15\dimexpr\scaledwidth\relax}% BASED ON PAPER'S RED LINE LOCATION
\def\topdiscard{.10\dimexpr\scaledheight\relax}% UNRULED TOP OF PAPER TO THROW AWAY
\def\topbottomgap{1pt}% GAP ADDED ABOVE/BELOW RULED BOX
\def\reducedindent{\dimexpr\naturalindent-\addedleftmargin\relax}% CALCULATED QUANTITY
\newcommand\linedbox[2]{\noindent\savestack\pagetext{\begin{minipage}[b]{%
\dimexpr#1-\naturalindent+\reducedindent-\addedrightmargin}%
\strut#2\strut
\end{minipage}%
}%
\addstackgap[\topbottomgap]{\stackinset{r}{\addedrightmargin}{t}{1pt}{\pagetext}%
{\clipbox{%
\reducedindent{}
\dimexpr\scaledheight-\topdiscard-\ht\pagetextcontent-\dp\pagetextcontent\relax{}
\dimexpr\scaledwidth-\dimexpr#1\relax-\reducedindent\relax{}
\topdiscard%
}%
{\includegraphics[height=\scaledheight,width=\scaledwidth]{lined-paper-template-9898}}}}%
}
\begin{document}
\lipsum[1]
{\centering\linedbox{4.3in}{\lipsum[1]Hi Mom!!}\par}
Or this: \linedbox{2in}{This is a test of the emergency broadcasting system.
This is only a test}
\end{document}
通用横格纸
请注意,geometry
边距\fontsize
需要进行修改以符合论文要求。
\documentclass{article}
\usepackage[margin=1.2in]{geometry}
\usepackage{everypage}
\usepackage{graphicx}
\usepackage{lipsum}
% THESE ARE LaTeX DEFAULTS; CAN CHANGE IF NEEDED.
\def\PageTopMargin{1in}
\def\PageLeftMargin{1in}
\newcommand\everyxy[3]{%
\AddEverypageHook{\smash{\hspace*{\dimexpr-\PageLeftMargin-\hoffset+#1\relax}%
\raisebox{\dimexpr\PageTopMargin+\voffset-#2\relax}{#3}}}}
\everyxy{0in}{11in}{\includegraphics[height=\paperheight,width=\paperwidth]{lined-paper-template-9898}}
\begin{document}
\fontsize{15pt}{18.8pt}\selectfont
\lipsum[1-3]
Hi Mom!!
\end{document}