如何使用 LaTeX 制作以下每日计划?
答案1
一种方法是:
- 使用
tablular
创建垂直数值数据, - 使用
collcell
将 a 应用于\tikzmark
表格的每一行, - 用于
tikz
根据行号插入括号和文本。
笔记:
- 可以允许数据自动换行,或者像棕色文本一样手动换行。
- 您可以通过选项更改文本的对齐方式
align=
,如蓝色、橙色和紫色文本所示。
代码:
\documentclass{article}
\usepackage{tikz}
\usetikzlibrary{calc,decorations.pathreplacing}
\usepackage{collcell}
\newcolumntype{R}{>{\collectcell\NewRowData}{r}<{\endcollectcell}}
\newcounter{RowCount}
\newcommand*{\NewRowData}[1]{%
\stepcounter{RowCount}%
\tikzmark{Left Mark of Row \arabic{RowCount}}%
\makebox[1.0em]{#1}%
\tikzmark{Right Mark of Row \arabic{RowCount}}%
}%
\newcommand{\tikzmark}[1]{%
\tikz[overlay,remember picture,baseline] \node [anchor=base] (#1) {};}
\newcommand*{\LeftTextWidth}{6.0cm}
\newcommand*{\RightTextWidth}{6.0cm}
\newcommand\LeftBrace[4][]{%
\begin{tikzpicture}[overlay,remember picture,baseline]
\draw[decorate,decoration={brace,raise=6pt, amplitude=1.0ex, mirror}, ultra thick, #1]
([yshift=3pt]Left Mark of #2.north east)
-- node[xshift=-10pt, align=left, text width=\LeftTextWidth, anchor=east, #1]
{#4}
([yshift=3pt]Left Mark of #3.south east);
\end{tikzpicture}
}
\newcommand\RightBrace[4][]{%
\begin{tikzpicture}[overlay,remember picture,baseline]
\draw[decorate,decoration={brace,raise=6pt, amplitude=1.0ex}, ultra thick, #1]
([xshift=2pt, yshift=3pt]Left Mark of #2.north east)
-- node[xshift=10pt, align=left, text width=\LeftTextWidth, anchor=west, #1]
{#4}
([xshift=2pt, yshift=3pt]Left Mark of #3.south east);
\end{tikzpicture}
}
\begin{document}
{\centering%
\begin{tabular}{R}
5 \\
6 \\
\\
7 \\
\\
8 \\
9 \\
10 \\
11 \\
12 \\
1 \\
2 \\
3 \\
4 \\
5 \\
6 \\
7 \\
8 \\
9 \\
10 \\
11 \\
12 \\
1 \\
2 \\
3 \\
4 \\
\end{tabular}
\par}
\LeftBrace[red]{Row 1}{Row 5}{%
Rise, wash, and address \emph{Powerful Goodness! Contrive day's business},
and take the resolution of the day;%
}
\RightBrace[brown]{Row 1}{Row 5}{%
The Morning. \\
Question: What good shall I do \\
this day?%
}
\RightBrace[magenta]{Row 6}{Row 9}{Work.}
\RightBrace[violet]{Row 10}{Row 11}{Read, or overlook my accounts, and dine.}
\LeftBrace[blue, align=center]{Row 10}{Row 11}{NOON.}
\RightBrace[olive]{Row 12}{Row 15}{Work.}
\LeftBrace[orange, align=center]{Row 16}{Row 19}{%
Evening \\
\emph{Question}: What good have I done \\
today?%
}
\RightBrace[purple]{Row 16}{Row 19}{%
Put things in their places. Supper.
Music or diversion, or conversation/
Examination of the day.
}
\LeftBrace[violet, align=center]{Row 20}{Row 26}{NIGHT.}
\RightBrace[red]{Row 20}{Row 26}{Sleep.}
\end{document}