Skip to content

Commit

Permalink
Merge branch 'master' into glossaries
Browse files Browse the repository at this point in the history
  • Loading branch information
clbarnes authored Oct 19, 2018
2 parents 662237c + 4e0505a commit d19fe31
Show file tree
Hide file tree
Showing 6 changed files with 103 additions and 12 deletions.
5 changes: 5 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -4237,6 +4237,11 @@ endef
#
# vim: noet sts=0 sw=8 ts=8


.PHONY: all-gls
all-gls: all
makeglossaries thesis; $(MAKE) all;

.PHONY: hooks
hooks:
./hooks/install.sh
File renamed without changes.
35 changes: 23 additions & 12 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -153,7 +153,7 @@ The class file, `PhDThesisPSnPDF`, is based on the standard `book` class

It supports the following custom options in the documentclass in thesis.tex:

(Usage `\documentclass[a4paper,11pt,print]{Classes/PhDThesisPSnPDF}`)
(Usage `\documentclass[a4paper,11pt,print]{PhDThesisPSnPDF}`)

* `a4paper` (default as per the University guidelines) or `a5paper`: Paper size

Expand Down Expand Up @@ -287,7 +287,7 @@ the bottom of the page. Pagewise line numbering is added on every page. `draft`

### Choosing the page style

`PhDThesisPSnPDF` defines 3 different page styles (header and footer). The following definition is for `twoside` layout. To choose a page style, include it in the `documentclass` options: `\documentclass[PageStyleI]{Classes/PhDThesisPSnPDF}`. Alternatively, page style can be changed by adding `\pagestyle{PageStyleI}` or `\pagestyle{PageStyleII}` in `thesis.tex`. Note: Using `\pagestyle` command will override `documentclass` options when used globally.
`PhDThesisPSnPDF` defines 3 different page styles (header and footer). The following definition is for `twoside` layout. To choose a page style, include it in the `documentclass` options: `\documentclass[PageStyleI]{PhDThesisPSnPDF}`. Alternatively, page style can be changed by adding `\pagestyle{PageStyleI}` or `\pagestyle{PageStyleII}` in `thesis.tex`. Note: Using `\pagestyle` command will override `documentclass` options when used globally.

* `default (leave empty)`: For Page Numbers in Header (Left Even, Right Odd) and Chapter Name in Header (Right Even) and Section #. Section Name (Left Odd). Blank Footer.

Expand Down Expand Up @@ -399,6 +399,21 @@ To include custom to-do notes in your pdf document use `\mynote{Hey! I have a n
\newcommand{\listoftodos}{}
\fi

## Git hooks

You rarely want to commit changes to your TeX files which are not reflected in the PDF included in the repo.
You can automate this process, among other things, with a git hook.
Install the hook with `make hooks` (or see how to do it in `./hooks/install.sh`).
Now every time you commit, if any files affecting your build have changed in this commit
and those changes are more recent than the last modification of `thesis.pdf`,
the default `make` target will be run and changes to `thesis.pdf` will be `git add`ed.

Currently, changes to any tex/pdf/eps/png/cls files are picked up.
This can be changed in `./hooks/pre-commit`.

Skip the hook with `git commit --no-verify`.

`bash`-only.

## General guidelines
[Why is it important to follow good practices and not get killed by a Velociraptor ;)](http://www.xkcd.com/292/)
Expand Down Expand Up @@ -484,32 +499,28 @@ You can also mail
--------------------------------------------------------------------------------
## Troubleshooting warnings

#### _W1_: I get the LaTeX Warning: You have requested document class `Classes/PhDThesisPSnPDF`, but the document class provides `PhDThesisPSnPDF`, should I be concerned?

No! Do nothing, or if you don't want any warning messages change the line near the top of the class file to \ProvidesClass{Classes/PhDthesisPSnPDF} if you're not going to install the class file in a more standard location. You can install it in a standard location like `/usr/share/texmf/tex/latex/` and run `texhash` to reconfigure.

#### _W2_:I get the package Fancyhdr Warning: \fancyhead's `E` option without twoside option is useless on input line \# or \#. What should I do?
#### _W1_:I get the package Fancyhdr Warning: \fancyhead's `E` option without twoside option is useless on input line \# or \#. What should I do?

Nothing. The warning is because the twoside option is also defined in the class, although only the oneside option is currently used.

#### _W3_: I get the Class PhDThesisPSnPDF Warning: Unknown or non-standard option 'something'. Will see if I can load it from the book class. If you get a warning unused global option(s): `something` then the option is not supported! on input line \#.
#### _W2_: I get the Class PhDThesisPSnPDF Warning: Unknown or non-standard option 'something'. Will see if I can load it from the book class. If you get a warning unused global option(s): `something` then the option is not supported! on input line \#.

You are either trying to use a undefined option or a non-standard option which is in the book class but not defined in the PhD Thesis Template. If it can be used it will be loaded and you will get no further warnings. If not, the option you chose is unavailable.


#### _W4_: I get LaTeX Warning: Unused global option(s):[something].
#### _W3_: I get LaTeX Warning: Unused global option(s):[something].

You are trying to load an option that is not supported in the PhDThesisClass and the Book Class. Are you sure you are using the right option? Check your spelling!

#### _W5_: I get I'm skipping whatever remains of this command line \# of file thesis.aux \@input{Chapter1/chapter1.aux}
#### _W4_: I get I'm skipping whatever remains of this command line \# of file thesis.aux \@input{Chapter1/chapter1.aux}

If you are generating a separate abstract for your thesis submission, ignore this warning and good luck with your submission. If you are compiling your thesis and see this warning, please remove the option `abstract` from the document class.

#### _W6_: I get blank pages between chapters
#### _W5_: I get blank pages between chapters

This is normal for a book class. Usually, a new chapter in a book always starts on the right hand side, which is why you see a blank page. You can remove the extra blank page by passing `openany` option to the documentclass. This works for double sided printing. However, if you are printing on a single side, please pass `oneside` option to the document class.

#### _W7_: My references aren't listed in the ordered in which I cite them
#### _W6_: My references aren't listed in the ordered in which I cite them

This is controlled by the bibliography style. Please use `\bibliographystyle{unsrt}` in `thesis.tex` instead of `apalike`. This applicable only for numerically sorted references.

Expand Down
File renamed without changes.
53 changes: 53 additions & 0 deletions hooks/install.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
#!/bin/bash

# Adapted from https://gist.github.com/tilap/0590e78c9cfd8f6548f5

# Basic script to set custom project hook and share it with other developpers
#
# cd [path-of-the-script]
# . install.sh
#
# Folders usecase
# /.git
# /.git/hooks
# /hooks/install.sh <- this script
# /hooks <- path of your hooks

set -e

# list of hooks the script will look for
HOOK_NAMES="applypatch-msg pre-applypatch post-applypatch pre-commit prepare-commit-msg commit-msg post-commit pre-rebase post-checkout post-merge pre-receive update post-receive post-update pre-auto-gc"

PROJECT_ROOT_DIR=`git rev-parse --show-toplevel`

# absolute folder path of directory into which hooks should be installed
TGT_DIR=$PROJECT_ROOT_DIR/.git/hooks

# absolute folder path of the custom hooks to deploy / current script
SRC_DIR=$PROJECT_ROOT_DIR/hooks

# relative folder path from the target dir to the source dir
LNS_RELATIVE_PATH=../../hooks

echo "Install project git hooks"

for hook in $HOOK_NAMES; do
# if we have a custom hook to set
if [ -f $SRC_DIR/$hook ]; then
echo "> Hook $hook"
if [ ! -x $SRC_DIR/$hook ]; then
echo " > Not executable, skipping"
continue
fi
# If the hook already exists, is executable, and is not a symlink
if [ ! -h $TGT_DIR/$hook -a -x $TGT_DIR/$hook ]; then
echo " > Old git hook $hook disabled"
# append .old to disable it
mv $TGT_DIR/$hook $TGT_DIR/$hook.old
fi

# create the symlink, overwriting the file if it exists
echo " > Enable project git hook"
ln -s -f $LNS_RELATIVE_PATH/$hook $TGT_DIR/$hook
fi
done
22 changes: 22 additions & 0 deletions hooks/pre-commit
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
#!/bin/bash
# look at all staged files with the given extensions;
# if any were modified more recently than your target,
# rebuild the target with the default `make` task,
# and `git add` the changed target file.

set -e

# extensions of files which may affect what your target looks like
extensions="tex|pdf|png|bib|eps|cls"

# your target file
tgt="thesis.pdf"

for fpath in $(git diff --cached --name-only --diff-filter=ACM | grep -P "\.${extensions}" | grep -v "${tgt}")
do
if test ${fpath} -nt ${tgt}; then
make
git add ${tgt}
break
fi
done

0 comments on commit d19fe31

Please sign in to comment.