数か月前に LaTeX を学び始めてからこのサイトを利用しています。皆さんのおかげで非常に役立っています。
私の問題は、私の大学の教授の中には、課題を入力することを好まない人がいることです。学生の中には、インターネットから答えをコピーして貼り付ける人もいるようで、私たちは問題を手で解くように言われます。今でも、問題文を LaTeX で保存して、それを印刷して手で完成させたいと思っており、それ以来ずっとそうしていますが、グリッドがないとあまりにも乱雑すぎると感じています。
ファイルを画像のようにしたいのですが、ドキュメントを PDF としてエクスポートし、何らかの「デザイン ソフトウェア」を使用してグリッドを描画することでこれを実現しましたが、課題のすべてのページ (通常は 8 ページ) でこれを行うのは時間がかかりすぎます。 ソースコードの例を残しておきます:
\documentclass[a4paper, 11pt]{article}
\usepackage{comment} % enables the use of multi-line comments (\ifx \fi)
\usepackage{fullpage} % changes the margin
\usepackage[a4paper, total={7in, 10in}]{geometry}
\usepackage[fleqn]{amsmath}
\usepackage{amssymb,amsthm} % assumes amsmath package installed
\newtheorem{theorem}{Theorem}
\newtheorem{corollary}{Corollary}
\usepackage{graphicx}
\usepackage{tikz}
\usetikzlibrary{arrows}
\usepackage{verbatim}
\usepackage{float}
\usepackage{tikz}
\usetikzlibrary{shapes,arrows}
\usetikzlibrary{arrows,calc,positioning}
\tikzset{
block/.style = {draw, rectangle,
minimum height=1cm,
minimum width=1.5cm},
input/.style = {coordinate,node distance=1cm},
output/.style = {coordinate,node distance=4cm},
arrow/.style={draw, -latex,node distance=2cm},
pinstyle/.style = {pin edge={latex-, black,node distance=2cm}},
sum/.style = {draw, circle, node distance=1cm},
}
\usepackage{xcolor}
\usepackage{mdframed}
\usepackage[shortlabels]{enumitem}
\usepackage{indentfirst}
\usepackage{hyperref}
\renewcommand{\thesubsection}{\thesection.\alph{subsection}}
\newenvironment{problem}[2][Problem]
{ \begin{mdframed} \textbf{#1 #2} \\}
{ \end{mdframed}}
% Define solution environment
\newenvironment{solution}
{\textbf{\textit{Ans.\\ \\ \\}}}
{}
\renewcommand{\qed}{\quad\qedsymbol}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\begin{document}
%Header-Make sure you update this information!!!!
\noindent
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\large\textbf{Homework - \#4} \hfill \textbf{Leonardo Sánchez} \\
Calculus 1 \hfill Civil \& Electromechanical Engineering \\
Professor Fang Jung Shiou \hfill Due date: $30^{th}$ March, 2020\\
Teacher Assistant: Paulo C. C. Galeano \\
\noindent\rule{7in}{2.8pt}
%Problem 1%
\begin{problem}{1 - (Section 11.3 Exs. 17 \& 21 - Page 726 - Stewart $8^{th}$ ed.)}
Determine whether the series is convergent or divergent.\\
a) $$\sum_{n=1}^\infty \cfrac{1}{n^2 + 4}.$$
b) $$\sum_{n=2}^{\infty}\cfrac{1}{n \ln n}.$$
\end{problem}
\begin{solution}
\pagebreak
\end{solution}
\end{document}
環境はそのようには機能せず、環境内にいくつかのものをネストすることはできないと読んだのですが、私の質問が適切に表現されていない場合、私が尋ねていることを実現するための正しい方法を誰か教えていただけますか?
前もって感謝します!
答え1
私の理解では、すべての質問に対してグリッドを印刷したいので、solution
環境は冗長になり、代わりにproblem
環境が自動的にグリッドを追加するようにすることができます。グリッドを描くのは簡単です。ティックZなので、主な問題はグリッドの大きさをどのくらいにするか、つまりページの下部がどこにあるかを知ることです。幸いなことに、tikzpagenodesパッケージはcurrent page text area
ノードを定義するので、現在の位置から までのグリッドを描画するだけで十分です(current page text area.south east)
。これを行うと、次のようになります。
グリッドの右側と下部に「半分の正方形」があるのはむしろ普通に見えると思ったので、完全な正方形だけがグリッドに印刷されるようにするために、少し余分なトリックがあります。これを実現するために、グリッドの正方形を 20pt x 20pt にして、座標を 20 の倍数に丸めました。グリッドのサイズをミリメートルで指定したかったのですが、これは面倒であることがわかりました。
グリッドを追加するだけでなく、problem
問題に自動的に番号を付けるカウンターを追加しました。次に、などを手動で入力するのではなく、環境を使用することをお勧めa)
します。b)
enumerate
\setlist
列挙項目$$...$$
パッケージを使用すると、OPのカウンターを取得できます。最後に、質問では方程式を使用せず、代わりに$\displaymath ...$
--を使用します。\[ ... \] が $$ ... $$ よりも好ましいのはなぜですか?
更新されたコードは次のとおりです。
\documentclass[a4paper, 11pt]{article}
\usepackage{comment} % enables the use of multi-line comments (\ifx \fi)
\usepackage{fullpage} % changes the margin
\usepackage[a4paper, total={7in, 10in}]{geometry}
\usepackage[fleqn]{amsmath}
\usepackage{amssymb,amsthm} % assumes amsmath package installed
\newtheorem{theorem}{Theorem}
\newtheorem{corollary}{Corollary}
\usepackage{graphicx}
\usepackage{tikz}
\usetikzlibrary{arrows}
\usepackage{verbatim}
\usepackage{float}
\usepackage{tikz}
\usetikzlibrary{shapes,arrows}
\usetikzlibrary{arrows,calc,positioning}
\tikzset{
block/.style = {draw, rectangle,
minimum height=1cm,
minimum width=1.5cm},
input/.style = {coordinate,node distance=1cm},
output/.style = {coordinate,node distance=4cm},
arrow/.style={draw, -latex,node distance=2cm},
pinstyle/.style = {pin edge={latex-, black,node distance=2cm}},
sum/.style = {draw, circle, node distance=1cm},
}
\usepackage{tikzpagenodes}
\usepackage{xcolor}
\usepackage{mdframed}
\usepackage[shortlabels]{enumitem}
\usepackage{indentfirst}
\usepackage{hyperref}
\renewcommand{\thesubsection}{\thesection.\alph{subsection}}
\newcounter{problem}
\newenvironment{problem}[2][Problem]
{ \refstepcounter{problem}%
\begin{mdframed}%
% the \detokenize checks to see if #2 is empty in which case
% nothing is printed
\textbf{#1 \theproblem\if\relax\detokenize{#2}\relax\else~-- (#2)\fi} \\
}
{ \end{mdframed}%
\textbf{\textit{Ans.}}\newline%
\begin{tikzpicture}[remember picture, overlay]
% some extra trickery to ensure that the grid only has whole squares
\draw[step=20pt, gray!40, thin]
let \p1=(current page text area.south east),
\n1={20*int(\x1/20)},
\n2={20*int(\y1/20)}
in (0,0) grid (\n1,\n2);
\end{tikzpicture}%
\pagebreak%
}
\usepackage{enumitem}
\setlist[enumerate]{label=\alph*)}
\renewcommand{\qed}{\quad\qedsymbol}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\begin{document}
%Header-Make sure you update this information!!!!
\noindent
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\large\textbf{Homework - \#4} \hfill \textbf{Leonardo Sánchez} \\
Calculus 1 \hfill Civil \& Electromechanical Engineering \\
Professor Fang Jung Shiou \hfill Due date: $30^{th}$ March, 2020\\
Teacher Assistant: Paulo C. C. Galeano \\
\noindent\rule{7in}{2.8pt}
%Problem 1%
\begin{problem}{Section 11.3 Exs. 17 \& 21 - Page 726 - Stewart $8^{th}$ ed.}
Determine whether the series is convergent or divergent.
\begin{enumerate}
\item $\displaystyle \sum_{n=1}^\infty \cfrac{1}{n^2 + 4}$.
\item $\displaystyle \sum_{n=2}^{\infty}\cfrac{1}{n \ln n}$.
\end{enumerate}
\end{problem}
%Problem 2%
\begin{problem}{}
Determine whether the series is convergent or divergent.
\begin{enumerate}
\item $\displaystyle \sum_{n=1}^\infty \cfrac{1}{n^2 + 4}$.
\item $\displaystyle \sum_{n=2}^{\infty}\cfrac{1}{n \ln n}$.
\end{enumerate}
\end{problem}
%Problem 3%
\begin{problem}{Section 11.3 Exs. 17 \& 21 - Page 726 - Stewart $8^{th}$ ed.}
Determine whether the series is convergent or divergent.
\begin{enumerate}
\item $\displaystyle \sum_{n=1}^\infty \cfrac{1}{n^2 + 4}$.
\item $\displaystyle \sum_{n=2}^{\infty}\cfrac{1}{n \ln n}$.
\end{enumerate}
\end{problem}
\end{document}