Skip to content

Commit

Permalink
Merge pull request #3 from henze-research-group/vscode-integration-cl…
Browse files Browse the repository at this point in the history
…eanup

Update steps for using with VSCode
  • Loading branch information
nllong authored Dec 3, 2023
2 parents 5ae323e + 1a4be4f commit 4b9397c
Show file tree
Hide file tree
Showing 8 changed files with 155 additions and 93 deletions.
55 changes: 46 additions & 9 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -1,33 +1,70 @@
{
"latex-workshop.latex.recipes":[
"latex-workshop.latex.autoClean.run": "onFailed",
"latex-workshop.latex.recipes": [
{
"name": "Build with glossaries",
"name": "Build without glossaries (pdflatex x2)",
"tools": [
"pdflatex",
"makeglossaries",
"bibtex",
"pdflatex",
"pdflatex"
]
},
{
"name": "Build with glossaries (pdflatex x2)",
"tools": [
"pdflatex",
"bibtex",
"makeglossaries",
"pdflatex",
"pdflatex"
]
}
],
"latex-workshop.latex.tools":[
"latex-workshop.latex.tools": [
{
"name": "pdflatex",
"command": "pdflatex",
"args": [
"--shell-escape",
"-synctex=1",
"-interaction=nonstopmode",
"-file-line-error",
"%DOC%"
]
],
"env": {}
},
{
"name": "makeglossaries",
"command": "makeglossaries",
"args": [
"%DOCFILE%"
]
}
"--shell-escape",
"%DOCFILE%"
],
"env": {}
},
{
"name": "bibtex",
"command": "bibtex",
"args": [
"%DOCFILE%"
],
"env": {}
}
],
"latex-workshop.latexindent.args": [
"-c",
"%DIR%/",
"%TMPFILE%",
"-y=defaultIndent: ' '"
],
"cSpell.words": []
"cSpell.words": [
"bibtex",
"DOCFILE",
"latexindent",
"makeglossaries",
"nonstopmode",
"pdflatex",
"synctex"
]
}
52 changes: 40 additions & 12 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,50 +9,78 @@ The resulting PDF contains examples on how to best use LaTeX for a PhD Prospectu

To use, open `main-cu-prospectus.tex` in your favorite Tex editor such as TexStudio or VSCode. You can also upload this entire package to Overleaf to edit collaboratively online.

One catch is that to see the acronyms the `makeglossaries` command needs to be in the build step. This repo committed the .vscode/settings.json file with the changes. To use VSCode and LaTeX, install the LaTeX Workshop extension. In TexStudio, this will need to be
manually configured as well. Also, it is common to have to call the `pdflatex` command twice to have the glossaries show up correctly.
One catch is that to see the acronyms the `makeglossaries` command needs to be in the build step. This repo committed the .vscode/settings.json file with the changes. To use VSCode and LaTeX, install the LaTeX Workshop extension. In TexStudio, this will need to be manually configured as well. Also, it is common to have to call the `pdflatex` command twice to have the glossaries show up correctly.

```
```json
"latex-workshop.latex.autoClean.run": "onFailed",
"latex-workshop.latex.recipes":[
{
"name": "Build with glossaries",
"name": "Build without glossaries (pdflatex x2)",
"tools": [
"pdflatex",
"makeglossaries",
"bibtex",
"pdflatex",
"pdflatex"
]
},
{
"name": "Build with glossaries (pdflatex x2)",
"tools": [
"pdflatex",
"bibtex",
"makeglossaries",
"pdflatex",
"pdflatex"
]
}
],
"latex-workshop.latex.tools":[
{
"name": "pdflatex",
"command": "pdflatex",
"args": [
"--shell-escape",
"-synctex=1",
"-interaction=nonstopmode",
"-file-line-error",
"%DOC%"
]
],
"env": {}
},
{
"name": "makeglossaries",
"command": "makeglossaries",
"args": [
"%DOCFILE%"
]
}
"--shell-escape",
"%DOCFILE%"
],
"env": {}
},
{
"name": "bibtex",
"command": "bibtex",
"args": [
"%DOCFILE%"
],
"env": {}
}
],
"latex-workshop.latexindent.args": [
"-c",
"%DIR%/",
"%TMPFILE%",
"-y=defaultIndent: ' '"
]
```

An example PDF is in this project [here](./main-cu-prospectus.pdf) and [here](./main-cu-phd-thesis.pdf) but a version is created each commit on GitHub. The GitHub veresion is [here](https://github.com/henze-research-group/latex-template/actions). Go to the latest passing workflow run, then click on the PDF text in the Artifacts section. Note that the GitHub build version does not have the Acronyms listing since the build step does not know how to `makeglossaries`.
An example PDF is in this project [here](./main-cu-prospectus.pdf) and [here](./main-cu-phd-thesis.pdf) but a version is created each commit on GitHub. The GitHub version is [here](https://github.com/henze-research-group/latex-template/actions). Go to the latest passing workflow run, then click on the PDF text in the Artifacts section. Note that the GitHub build version does not have the Acronyms listing since the build step does not know how to `makeglossaries`.

The difference between the prospectus and thesis is minimal. The prospectus version contains language that it is just that, a prospectus, and the thesis.cls has the approval page.

## Notes

If using vscode, then the latex-formatter might require an installation of a PERL library called HomeDir. This can be accomplished (on macOS) with the following brew install command.
If using VSCode, then the latex-formatter might require an installation of a PERL library called HomeDir. This can be accomplished (on macOS) by installing the `latexindent` package with the following brew install command.

```
```bash
brew install latexindent
```
82 changes: 41 additions & 41 deletions chapter1-intro.tex
Original file line number Diff line number Diff line change
Expand Up @@ -10,21 +10,21 @@ \section{Figures}
Figures have to be saved in a \texttt{figures} as defined in the main \texttt{main-cu-example.tex} file. Figure \ref{fig_commercial_end_uses} shows the breakdown of commercial building energy consumption in the United States \cite{EnergyInformationAdministration2020}.

\begin{figure}[H]
\begin{center}
\includegraphics[width=0.5\linewidth]{fig_commercial_end_uses.png}
\end{center}
\caption{Commercial building energy use}
\label{fig_commercial_end_uses}
\begin{center}
\includegraphics[width=0.5\linewidth]{fig_commercial_end_uses.png}
\end{center}
\caption{Commercial building energy use}
\label{fig_commercial_end_uses}
\end{figure}

If the figure has a citation in it, then make sure to use the ``two level caption" so the citation does not appear in the table of contents. This can cause an issue when the references/citations are shown in the order of appearance. Note the use of square brackets as the first caption.

\begin{figure}[H]
\begin{center}
\includegraphics[width=0.5\linewidth]{fig_energy_peak_demand.png}
\end{center}
\caption[Peak demand reduction vs energy saved by building technology]{Peak demand reduction vs energy saved by building technology \cite{Satchwell2021}}
\label{fig_energy_peak_demand}
\begin{center}
\includegraphics[width=0.5\linewidth]{fig_energy_peak_demand.png}
\end{center}
\caption[Peak demand reduction vs energy saved by building technology]{Peak demand reduction vs energy saved by building technology \cite{Satchwell2021}}
\label{fig_energy_peak_demand}
\end{figure}


Expand All @@ -33,37 +33,37 @@ \section{Tables}
An example table with caption is shown in Table \ref{tbl_example}.

\begin{table}[H]
\centering
\caption{Example table of objectives}
\begin{tabular}{|L{4.5cm}|L{5.5cm}|L{5.0cm}|}
\hline
\rowcolor{lightgray}
\textbf{Research Objective} & \textbf{Method of Achievement} & \textbf{Expected Outcome} \\ \hline \hline
% next row
Cell 1 & Cell 2 & Cell 2 \\ \hline
% next row
Another cell &
And another cell with some text wrapping if there is enough text needed for it to wrap based on the fixed width defined in the tabular definition &
Last cell for this row \\ \hline
\end{tabular}
\label{tbl_example}
\centering
\caption{Example table of objectives}
\begin{tabular}{|L{4.5cm}|L{5.5cm}|L{5.0cm}|}
\hline
\rowcolor{lightgray}
\textbf{Research Objective} & \textbf{Method of Achievement} & \textbf{Expected Outcome} \\ \hline \hline
% next row
Cell 1 & Cell 2 & Cell 2 \\ \hline
% next row
Another cell &
And another cell with some text wrapping if there is enough text needed for it to wrap based on the fixed width defined in the tabular definition &
Last cell for this row \\ \hline
\end{tabular}
\label{tbl_example}
\end{table}

\section{Equations}

ASHRAE Guideline 14's \cite{Landsberg2014} \gls{CVRMSE} and \gls{NMBE} calculations shown in Equations \ref{eq_cvrmse} and \ref{eq_nmbe}, respectively, as well as $r^2$ and various visual plots generated by the \gls{MMF}.

\begin{equation}
\label{eq_cvrmse}
CVRMSE=\frac{1}{\bar{y}}\sqrt{\frac{\sum{(y_i-\hat{y}_i)^2}}{n-1}}
\label{eq_cvrmse}
CVRMSE=\frac{1}{\bar{y}}\sqrt{\frac{\sum{(y_i-\hat{y}_i)^2}}{n-1}}
\end{equation}
where $y_i$ is the actual data at timestep, $i$, $\hat{y}_i$ is the modeled (or estimate) of the data at timestep, $i$, $\bar{y}$ is the mean of the actual data, and $n$ is the number of samples.

\bigskip

\begin{equation}
\label{eq_nmbe}
NMBE=\frac{\sum{(y_i - \hat{y}_i})}{(n-1) \cdot \bar{y}}
\label{eq_nmbe}
NMBE=\frac{\sum{(y_i - \hat{y}_i})}{(n-1) \cdot \bar{y}}
\end{equation}
where $y_i$ is the actual data at timestep, $i$, $\hat{y}_i$ is the modeled (or estimate) of the data at timestep, $i$, $\bar{y}$ is the mean of the actual data, and $n$ is the number of samples.

Expand All @@ -79,19 +79,19 @@ \section{Lists and Enumerations}
Example of nested enumeration and lists (also known as itemize in \LaTeX\ speak).

\begin{enumerate}
\item First item
\begin{itemize}
\item Example of just a bullet item
\item Another item
\item Last item!
\end{itemize}

\item Second numbered item
\begin{enumerate}
\item Keep the list going,
\item With more items,
\item But now I'm done.
\end{enumerate}
\item First item
\begin{itemize}
\item Example of just a bullet item
\item Another item
\item Last item!
\end{itemize}

\item Second numbered item
\begin{enumerate}
\item Keep the list going,
\item With more items,
\item But now I'm done.
\end{enumerate}
\end{enumerate}

\section{Code Snippets}
Expand Down
10 changes: 4 additions & 6 deletions macros.tex
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@

\newtheorem{theorem}{Theorem}


\newcommand{\diff}[2]{\frac{\partial #1}{\partial #2}}
\newcommand{\diffr}[1]{\diff{#1}{r}}
\newcommand{\diffth}[1]{\diff{#1}{\theta}}
Expand All @@ -10,14 +8,14 @@
\newcommand{\vth}{V_{\theta}}

\newcommand{\twochoices}[2]{\left\{ \begin{array}{lcc}
\displaystyle #1 \\ \vspace{-10pt} \\
\displaystyle #2\end{array} \right. } %}
\displaystyle #1 \\ \vspace{-10pt} \\
\displaystyle #2\end{array} \right. } %}

\newcommand{\threechoices}[3]{\left\{ \begin{array}{lcc}
#1 \\ #2 \\ #3\end{array} \right. } %}
#1 \\ #2 \\ #3\end{array} \right. } %}

\newcommand{\fourchoices}[4]{\left\{ \begin{array}{lcc}
#1 \\ #2 \\ #3 \\ #4\end{array} \right. } %}
#1 \\ #2 \\ #3 \\ #4\end{array} \right. } %}

\newcommand{\twovec}[2]{\left(\begin{array}{c} #1 \\ #2 \end{array}\right)}
\newcommand{\threevec}[3]{\left(\begin{array}{c} #1 \\ #2 \\ #3 \end{array}\right)}
Expand Down
Binary file modified main-cu-phd-thesis.pdf
Binary file not shown.
22 changes: 11 additions & 11 deletions main-cu-phd-thesis.tex
Original file line number Diff line number Diff line change
Expand Up @@ -68,26 +68,26 @@

%%%%%%%%%%%% All the preamble material: %%%%%%%%%%%%

\title{CU Example Prospectus Document}
\title{CU Example Dissertation Thesis}

\author{First Middle}{Last}

\otherdegrees{B.S., University of Colorado, 2016 \\
M.S., University of Colorado, 2020}
M.S., University of Colorado, 2020}

\degree{Doctor of Philosophy} % #1 {long descr.}
\degree{Doctor of Philosophy} % #1 {long descr.}
{Ph.D., Architectural Engineering} % #2 {short descr.}

\dept{Department of} % #1 {designation}
{Civil, Environmental and Architectural Engineering} % #2 {department name}
\dept{Department of} % #1 {designation}
{Civil, Environmental and Architectural Engineering} % #2 {department name}

\advisor{Gregor Henze, Ph.D, P.E.} {\normalsize } % #1 {title}
%{Ph.D., P.E.} % #2 {name}
\advisor{Prof.} % #1 {title}
{Gregor Henze, Ph.D, P.E.} {\normalsize } % #2 {name}

\reader{Second Advisor , Ph.D.} % 2nd person to sign thesis
\readerThree{Third Advisor, Ph.D.} % 3rd person to sign thesis
\readerFour{Fourth Advisor, Ph.D.} % 4th person to sign thesis
\readerFive{Fifth Advisor, Ph.D.} % 5th person to sign thesis
\reader{Second Advisor, Ph.D.} % 2nd person to sign thesis
\readerThree{Third Advisor, Ph.D.} % 3rd person to sign thesis
\readerFour{Fourth Advisor, Ph.D.} % 4th person to sign thesis
\readerFive{Fifth Advisor, Ph.D.} % 5th person to sign thesis

\abstract{ \OnePageChapter % because it is very short

Expand Down
Binary file modified main-cu-prospectus.pdf
Binary file not shown.
Loading

0 comments on commit 4b9397c

Please sign in to comment.