帶有線條的規則文字框

帶有線條的規則文字框

我想要一個「字母」的功能。我所說的字母是指它是一張直紋紙,而且文字看起來合理,就好像它沒有“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 頂部:

  1. \addedleftmargin橫線框的左邊距(目前為 20pt);

  2. \addedrightmargin襯線框的右邊距(目前為 20pt);

  3. \scaledheight縮放後的紙張高度。用於將紙張的標線間距與您的字體大小(目前為 6.98 英吋)相匹配;

  4. \scaledwidth縮放後的紙張寬度。它至少應該與您打算製作的最寬框一樣大(它的值將影響紅線的外觀寬度和左邊距大小)(當前\textwidth);

  5. \naturalindent縮放紙張的自然左縮放,通常到紅線右側的點(目前為 的 15% \scaledwidth)。

  6. \topdiscard縮放影像頂部要丟棄的不規則紙張數量(目前為 10% \scaledheight);和

  7. \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}

在此輸入影像描述

相關內容