-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathNnnCCPxx-1.tex
173 lines (153 loc) · 8.98 KB
/
NnnCCPxx-1.tex
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
% !TEX program = lualatexmk
% !TEX encoding = UTF-8 Unicode
%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 80 columns %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% INSTRUCTIONS FOR OVERLEAF USERS:
%
% 1. Create a new, empty Overleaf project. Name it "mandi template" or
% something similar.
% 2a. mandi version 3.22 is included with TeX Live 2024 and is available on
% Overleaf. If you want to use this version, all you need are the files
% NnnCCPxx-1.tex and NnnCCPxx-2.tex. If you have a free Overleaf account,
% choose NnnCCPxx-1.tex. If you have a paid account, choose NnnCCPxx-2.tex.
% The reason is that free accounts are limited to a fixed number of compiler
% passes per document before timing out. A free account should be all a
% typical introductory physics student needs.
% 2b. Overleaf only updates TeX Live once per year and mandi may have changed
% to a version not included in TeX Live. In that case, you will need the
% file(s) from part a) and additionally the files mandi.sty,
% mandistudent.sty, and mandiexp.sty.
% 2c. The file mandi.pdf is the official bundle documentation, but Overleaf
% will not let you view it so you need not upload it. Instead, open it in a
% tab in your browser. Alternatively, you can view the documentation online
% by going to https://texdoc.org/ and searching for mandi and opening the
% resulting PDF file in your browser.
% 2d. Upload the files you need to your new empty project folder on Overleaf.
% 3. From inside the project folder, click the Menu button in the upper
% left corner and set Compiler to LuaLaTeX, TeX Live Version to the
% latest available, and Main document to NnnCCPxx-1.tex (for free
% accounts) or NnnCCPxx-2 (for paid accounts). Other options may be set
% as desired. Dismiss the configuration window by clicking anywhere on its
% exterior.
% 4. Click the NnnCCPxx-1.tex (or NnnCCPxx-2.tex) file so that it is selected.
% Now click Recompile and a newly created PDF document should appear.
% 5. At this point you have a clean, original project to use as a template.
% 6. Make a new copy of your newly created "mandi template" (or whatever you
% named it) project. Name it NnnCCPxx by replacing Nnn with your last name
% (e.g. Heafner, Rodriguez, Nguyen, Jackson, Lee, etc.), replacing CC with a
% two digit chapter number (e.g. 03), leaving P unchanged, and xx is a two
% or three digit problem number (e.g. 25, 025, 101, etc.). With modern
% filesystems practically any names can be accommodated.
% 7. From inside this newly created project, rename the NnnCCPxx-1.tex (or
% NnnCCPxx-2.tex) file using the same convention as in the previous step.
% 8. The file is now ready for editing and writing up a problem solution.
% Your instructor will provide details.
% 9. You can copy the new files to your projects from within your projects if
% you want to. Doing so may necessitate editing your existing documents.
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 80 columns %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\documentclass[10pt]{article}
\usepackage{mandi} % load mandi
\usepackage{mandistudent} % load mandistudent
\usepackage{mandiexp} % load mandiexp
\usepackage{numerica} % for computation
\usepackage{geometry} % for changing page layout
\usepackage{mwe} % for demo images
\hypersetup{colorlinks} % color hyperlinks
%---------- DO NOT EDIT THESE LINES!
% See https://tex.stackexchange.com/q/156383/218142
\newcommand*{\pkg}[1]{\textsf{#1}} % typeset package names
\newcommand*{\mandi}{\textsf{mandi}} % typeset mandi
\newcommand*{\mandistudent}{\textsf{mandistudent}} % typeset mandistudent
\newcommand*{\mandiexp}{\textsf{mandiexp}} % typeset mandiexp
\newcommand*{\WebVPython}{\texttt{Web VPython}} % typeset WebVPython
\newcommand*{\WebVPythonorg}{\texttt{WebVPython.org}} % typeset WebVPython.org
\newcommand*{\VPython}{\texttt{VPython}} % typeset VPython
\newcommand*{\VPythonorg}{\texttt{VPython.org}} % typeset VPython.org
\newcommand*{\gsurl}{webvpython.org} % WebVPython URL
\newcommand*{\vpurl}{vpython.org} % VPython URL
\newcommand*{\lualatex}{Lua\LaTeX} % typeset LuaLaTeX
%---------- END
%---------- DOCUMENT MARGINS (EDIT TO SUIT)
\geometry{margin=0.5in,top=1.5in,bottom=1.5in}
%---------- END DOCUMENT MARGINS
%---------- STUDENT INFORMATION (EDIT TO SUIT)
\newcommand{\assignment}{ASSIGNMENT TITLE} % Edit this appropriately.
\newcommand{\authorname}{Your Name} % Edit this to use your name.
%---------- END STUDENT INFORMATION
\begin{document}
\title{\assignment}
\author{\authorname}
\maketitle
\thispagestyle{empty}
\centerline{Using \mandi{} version \mandiversion}
\centerline{Using \mandistudent{} version \mandistudentversion}
\centerline{Using \mandiexp{} version \mandiexpversion}
\listofwebvpythonprograms
\listoffigures
\newpage
%---------- YOUR WORK (EDIT TO SUIT)
\begin{physicsproblem}{PROBLEM TITLE HERE}
Every document must have only ONE problem. You can have as many problem parts as you need.
Each part will need a \normalfont{\ttfamily{\small{physicssolution}}} environment \emph{only}
if extended mathematical content is necessary. This sample problem is about the Lorentz
factor \( \gamma \).
\begin{parts}
\problempart
This is an example of how you would typeset a response that does not require a multistep
mathematical solution. You can include inline mathematics such as
\( \vec{p}=m\gamma\vec{v} \). If you were asked to state whether the Lorentz factor
\( \gamma \) is a scalar or a vector, you would simply state: The Lorentz factor is a
scalar.
\problempart
Here is a sample mathematical solution requiring multiple steps. Let's calculate the
Lorentz factor for a speed of \( \velocityc{0.986} \).
% Set up constants for numerica to use
\nmcConstants{v=0.986}
\begin{physicssolution}
\gamma &= \frac{1}{\sqrt{1-\frac{\vec{v}\cdot\vec{v}}{\lightspeed^{2}}}}
\reason{definition of \(\gamma\)} \\
\vec{v}\cdot\vec{v} &= \magnitude{\vec{v}}^{2}
\reason{dot product and magnitude squared} \label{step:2} \\
\vec{v}\cdot\vec{v} &= (\velocityc{0.986})^{2}
\reason{need to use given value} \\
\gamma &= \frac{1}{\sqrt{1-\frac{(\velocityc{0.986})^{2}}{\lightspeed^{2}}}}\label{step:4}
\reason{substitute numerical values} \\
\gamma &= \frac{1}{\sqrt{1-(0.986)^{2}}}
\reason{factors of \( \lightspeed \) divide out} \\
\therefore \gamma &\approx \fpeval{round(1/sqrt(1-0.986^2),3)}\label{step:6}
\reason{final answer using \LaTeX's \texttt{fpeval}} \\
\therefore \gamma &\approx \eval{1/\sqrt{1-v^{2}}}[3]\label{step:7}
\reason{final answer using \pkg{numerica}'s \texttt{eval}}
\end{physicssolution}
We gave some steps labels so we can refer back to them. Step \ref{step:2} should be
familiar to you. Step \ref{step:4} illustrates why setting \( \lightspeed = 1 \) is
handy. Steps \ref{step:6} and \ref{step:7} show how to get \LaTeX{} to do computation
for you two different ways.
Traditional figures can be included with one line of \LaTeX{} code. Again,
let \LaTeX{} handle the placement for you. The placement may not seem logical
to you, but that's okay. You can always refer directly to the figure.
\image[scale=1]{example-image-1x1}{A traditional diagram.}{fig:1}
Figure \ref{fig:1} is nice. It's captioned \nameref{fig:1} and is on
page \pageref{fig:1}.
\problempart
Finally, suppose you are asked to write and include a \WebVPython{} program.
It is simple! Once again, let \LaTeX{} handle the placement for you. The
placement may not seem logical to you, but that's okay. Unlike a traditional
figure, the program's caption will always be at the top of the program.
\textbf{Do not include the \texttt{https://} in the URL because that is
added for you!}
\begin{webvpythonblock}(glowscript.org/#/user/heafnerj/folder/mandidemo/program/placeholder)
{A Placeholder Program}
Web VPython 3.2
# This is just a placeholder.
# It is part of the mandi documentation.
sphere()
\end{webvpythonblock}
\WebVPython{} program \ref{gs:1} is nice. It's called \nameref{gs:1} and is on
page \pageref{gs:1}. Scanning the QR code, clicking the URL, or clicking anywhere
in the gray box (between the two thick horizontal black lines) will take you to
the program's source code.
\end{parts}
\end{physicsproblem}
%---------- END YOUR WORK
\end{document}