Skip to content

Commit

Permalink
rewrite part of image and equation
Browse files Browse the repository at this point in the history
  • Loading branch information
FoxerLee committed Sep 26, 2019
1 parent fa56c0f commit c9ea899
Show file tree
Hide file tree
Showing 3 changed files with 51 additions and 49 deletions.
62 changes: 28 additions & 34 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,29 +18,6 @@ Written by [Yuan Li](https://github.com/FoxerLee), idea comes from [homework-tem
\end{answer}
```

- Other basic information

```latex
\course
{\setlength{\unitlength}{1mm}
\begin{picture}(0,0)
\put(0,0){\includegraphics[width=0.7cm]{img/NYU.png}}
\end{picture}
} % University's logo
{Fall 2019} % semester
{CS-GY 6923} % course number
\university
{New York University} % university
{Tandon school of Engineering} % department
\assignment
{Homework} % assignment name
{Foxerlee} % student name
{N12345678} % student ID
{[email protected]} % student email
```

- How to add Code

```latex
Expand All @@ -55,25 +32,42 @@ Written by [Yuan Li](https://github.com/FoxerLee), idea comes from [homework-tem
\end{lstlisting}
```

- How to add Image
- `\image` Add a image

```latex
\begin{figure}[!ht]
\begin{center}
\includegraphics[width = 0.6\textwidth]{img/NYU.png}
\end{center}
\end{figure}
\image{0.4}{img/NYU.png} % para1 -- size, para2 -- image source
```

- How to add Equation
- `equ` Where to write equation

```latex
\begin{equation}\nonumber
\begin{aligned}
\begin{equ}
E_{in}(w) &= \frac{1}{10}\sum_{i=1}^{10}(\hat{y}_i + y_i)^2\\
&= \frac{1}{N}||Xw-y||_2^2
\end{aligned}
\end{equation}
\end{equ}
```

- Other basic information

```latex
\course
{\setlength{\unitlength}{1mm}
\begin{picture}(0,0)
\put(0,0){\includegraphics[width=0.7cm]{img/NYU.png}}
\end{picture}
} % University's logo
{Fall 2019} % semester
{CS-GY 6923} % course number
\university
{New York University} % university
{Tandon school of Engineering} % department
\assignment
{Homework} % assignment name
{Foxerlee} % student name
{N12345678} % student ID
{[email protected]} % student email
```

- Chinese is supported.
Expand Down
Binary file modified assignment.pdf
Binary file not shown.
38 changes: 23 additions & 15 deletions assignment.tex
Original file line number Diff line number Diff line change
Expand Up @@ -108,12 +108,28 @@
\vspace{0.5em}
}

\newcommand{\image}[2]{
\begin{figure}[!ht]
\begin{center}
\includegraphics[width = #1\textwidth]{#2}
\end{center}
\end{figure}
}

\newenvironment{answer}{
\noindent
\textit{Answer:}

}{\vspace{1em}}

\newenvironment{equ}{
\begin{equation}\nonumber
\begin{aligned}}{\end{aligned}
\end{equation} }
\newenvironment{codes}{\begin{lstlisting}[frame=shadowbox]}{\end{lstlisting}}
\newcommand{\oldmaketitle}{\maketitle}
\renewcommand{\maketitle}{
\begin{center}
Expand Down Expand Up @@ -177,25 +193,22 @@
Equation:
\begin{equation}\nonumber
\begin{aligned}
\begin{equ}
E_{in}(w) &= \frac{1}{10}\sum_{i=1}^{10}(\hat{y}_i + y_i)^2\\
&= \frac{1}{N}||Xw-y||_2^2
\end{aligned}
\end{equation}
\end{equ}
Matrix:
\begin{equation}\nonumber
\begin{aligned}
\begin{equ}
\left[\begin{array}{cccc}
0.7 & 55 & 1 & 0\\
1.3 & 65 & 0 & 1\\
1.6 & 70 & 0 & 1
\end{array}\right]
\end{aligned}
\end{equation}
\end{equ}
Expand All @@ -209,11 +222,7 @@
\begin{answer}
\begin{figure}[!ht]
\begin{center}
\includegraphics[width = 0.6\textwidth]{img/NYU.png}
\end{center}
\end{figure}
\image{0.4}{img/NYU.png} % para1 -- size, para2 -- image source
\end{answer}
Expand All @@ -223,14 +232,13 @@
\begin{answer}
\begin{lstlisting}[title=Python code, frame=shadowbox]
\begin{lstlisting}[frame=shadowbox]
import numpy as np
x = np.array([137, 135, 127, 122, 120, 118, 118, 117, 117, 114])
y = np.array([28540, 40133, 39900, 0, 0, 42050, 43220, 39565, 40400, 54506])
A = np.vstack([x, np.ones(len(x))]).T
m, c = np.linalg.lstsq(A, y, rcond=None)[0]

\end{lstlisting}
\end{answer}
Expand Down

0 comments on commit c9ea899

Please sign in to comment.