我正在努力创建一个环境,让我可以在 LaTeX 中记笔记,这样它看起来就像笔记本纸和手写体一样。到目前为止,我的代码如下(我包括了图形、表格、文本和标题,因为我想看看它们是什么样子):
\documentclass[letterpaper, 10pt]{article}
\usepackage{tikz, background, titling, setspace,titlesec,booktabs,float}
\usepackage[left=1.5in,right=.25in,top=1.125in,bottom=.125in]{geometry}
\usetikzlibrary{calc}
\backgroundsetup{%
position=current page.center,
angle=0,
scale=1,
contents={%
\begin{tikzpicture}%
[
normal lines/.style={gray, very thin},
every node/.append style={black, align=center, opacity=1}
]
\foreach \y in {0.71,1.41,...,25.56}
\draw[normal lines] (0,\y) -- (8.5in,\y);
\draw[normal lines] (1.25in,0) -- (1.25in,11in);
\node (t) [font=\LARGE, anchor=south] at ($(0,25.56)!1/2!(8.5in,25.56)$) {\thetitle};
\node (d) [font=\large, anchor=south west, xshift=1.5em] at (0,25.6) {\today};
\node (p) [font=\large, anchor=south east, xshift=-1.5em] at (8.5in,25.56) {p.~\thepage};
\end{tikzpicture}%
}}
\titleformat{\section}[display]{\normalfont\large\bfseries}{}{0em}{}
\renewcommand{\rmdefault}{augie}
\title{Notes}
\author{Heather Young}
\begin{document}
\pagestyle{empty}
\doublespacing
\section{Math}
$x = \frac {-b \pm \sqrt{b^2 - 4ac}}{2a}$ the quadratic formula
$0 = ax^2 + bx + c$ mathematics is awesome
\section{Physics}
$\gamma \to e^+ + e^-$
\section{Coding}
Ever heard of LaTeX? No? Well, it's awesome, and it's what this document is written in.
\section{Diagrams + Doodling}
\begin{tikzpicture}
\draw (0,0) rectangle (4,4);
\draw (0,0) -- (4,4);
\end{tikzpicture}
\begin{table}[H]
\begin{tabular}{|l|l|}
\toprule
X & Y \\
\midrule
0 & 1 \\
\hline
3 & 5 \\
\hline
4 & 7 \\
\bottomrule
\end{tabular}
\label{tab:my_label}
\end{table}
\end{document}
结果如下
这有两个主要问题:
- 并非所有文本都在一行上,我不知道为什么。我尝试调整该部分的标题格式,这样就不会产生任何影响,但我认为这根本没有帮助。
- 页面顶部不应该显示“4”,而应该显示“注释”,但是却没有显示,而且我也不知道为什么。
任何帮助都将不胜感激。谢谢!
笔记本代码归功于 cfr,答案如下:这个问题。我正在使用 sharelatex.com。
编辑:我尝试删除图形和表格以查看是否存在问题,但部分文本仍然不在一行上。
答案1
这样会更接近一些,对各种元素进行更严格的控制以保持基线间距。
\documentclass[letterpaper, 10pt]{article}
\usepackage{tikz, background, titling, setspace,titlesec,booktabs,float}
\usepackage[left=1.5in,right=.25in,top=1.125in,bottom=.125in]{geometry}
\usetikzlibrary{calc}
\makeatletter
\backgroundsetup{%
position=current page.center,
angle=0,
scale=1,
contents={%
\begin{tikzpicture}%
[
normal lines/.style={gray, very thin},
every node/.append style={black, align=center, opacity=1}
]
\foreach \y in {0.71,1.41,...,25.56}
\draw[normal lines] (0,\y) -- (8.5in,\y);
\draw[normal lines] (1.25in,0) -- (1.25in,11in);
\node (t) [font=\LARGE, anchor=south] at ($(0,25.56)!1/2!(8.5in,25.56)$) {\@title};
\node (d) [font=\large, anchor=south west, xshift=1.5em] at (0,25.6) {\today};
\node (p) [font=\large, anchor=south east, xshift=-1.5em] at (8.5in,25.56) {p.~\thepage};
\end{tikzpicture}%
}}
\titleformat{\section}[display]{\normalfont\bfseries}{}{0em}{}
\titlespacing{\section}{0pt}{\baselineskip}{\baselineskip}
\setlength\lineskip{0pt}
\renewcommand{\rmdefault}{augie}
\title{Notes}
\author{Heather Young}
\begin{document}
\pagestyle{empty}
\doublespacing
\section{Math}
$\smash{x = \frac {-b \pm \sqrt{b^2 - 4ac}}{2a}}$ the quadratic formula
$0 = ax^2 + bx + c$ mathematics is awesome
\section{Physics}
$\gamma \to e^+ + e^-$
\section{Coding}
Ever heard of LaTeX? No? Well, it's awesome, and it's what this document is written in.
\section{Diagrams + Doodling}
\begin{tikzpicture}
\draw (0,0) rectangle (4,4);
\draw (0,0) -- (4,4);
\end{tikzpicture}
\begin{tabular}[t]{|l|l|}
\toprule
X & Y \\
\midrule
0 & 1 \\
\hline
3 & 5 \\
\hline
4 & 7 \\
\bottomrule
\end{tabular}
\end{document}