Skip to content

Commit

Permalink
Ibids no longer affect capitalization of postnotes (#114)
Browse files Browse the repository at this point in the history
* Test for #102

* Closes #102

Requires TeXLive to check

* GR fixes

* Change travis for faster build, grattex tests

* Add required entries to bibliography

* Fix travis syntax; complete test

* Add png to documentation

* Add more PNGs

* Add edit-travis

* Add OK mark to prove travis

* Correct logic; less verbose output

* Images

* Warrants a new version
  • Loading branch information
HughParsonage authored Feb 26, 2018
1 parent dcd2894 commit 5e1e90d
Show file tree
Hide file tree
Showing 22 changed files with 64 additions and 8 deletions.
6 changes: 4 additions & 2 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,8 @@ before_install:
- source ./travis/texlive.sh
- tlmgr install acronym bigfoot blindtext chngcntr cmap nowidow mdframed navigator needspace tablefootnote tocloft xpatch multirow bbding mathastext isomath relsize
- if [ $TRAVIS_REPO_SLUG == "HughParsonage/grattex" ]; then tlmgr install tex-gyre eulervm bold-extra fancyvrb realboxes manfnt lstaddons; fi
# pdftotext
- if [ $TRAVIS_REPO_SLUG == "HughParsonage/grattex" ]; then sudo apt-get install poppler-utils; fi
- tlmgr update --all
- sudo apt-get update
- sudo apt-get install texlive-bibtex-extra
Expand All @@ -68,8 +70,7 @@ before_script:
- tar xzf biber-linux_x86_64.tar.gz
- export PATH=$PATH:$PWD
- tlmgr update biber
- sudo apt-get install -y r-cran-rcpp r-cran-bh r-cran-stringi r-cran-hunspell
- Rscript -e 'if (!requireNamespace("devtools", quietly = TRUE)) install.packages("devtools")'
- Rscript -e 'if (!requireNamespace("hunspell", quietly = TRUE)) system("sudo apt-get install -y r-cran-devtools r-cran-rcpp r-cran-bh r-cran-stringi r-cran-hunspell")'
- Rscript -e 'install.packages("TeXCheckR")'
- Rscript -e 'devtools::install_github("hughparsonage/hutils")'
- Rscript -e 'devtools::install_github("hughparsonage/TeXCheckR")'
Expand All @@ -79,6 +80,7 @@ script:
- set -e
- for i in *.tex; do pdflatex -interaction=nonstopmode $i > /dev/null 2>&1; done
- Rscript -e 'library(grattanReporter);checkGrattanReport(compile = TRUE, pre_release = TRUE, .proceed_after_rerun = 3)'
- if [ $TRAVIS_REPO_SLUG == "HughParsonage/grattex" ]; then Rscript tests/test_grattex.R; fi
- cd doc
- if [ $TRAVIS_REPO_SLUG == "HughParsonage/grattex" ]; then Rscript checkDocumentation.R; fi

Expand Down
4 changes: 4 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,10 @@ If **you do not have a ShareLaTeX account**:

## Changelog

### 2018-02-26
* Fix issue #102 which manifested on TeX Live distributions (like Travis-CI) where `Ibid. (<page ref>)`
resulted in the `p` being uppercase (PR #114). Thanks to JD for filing.

### 2017-09-01
* Increase hyphenation penalties. Closes #85

Expand Down
17 changes: 16 additions & 1 deletion Report.tex
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
\documentclass{grattan}
% Comments are deployed by the % sign; everything after % is ignored by the compiler.
% Please do not put comments before \documentclass as these are reserved for TeX directives.
% add_to_dictionary: SSBs?
% add_to_dictionary: SSBs? roman

\addbibresource{bib/put-new-refs-here.bib}

Expand Down Expand Up @@ -420,6 +420,21 @@ \chapter{Testing suite 2}\label{chap:test-2}
Some text in a small box.
Some other text in a small box.
\end{smallbox}

\chapter{Testing suite 3}\label{chap:ibid-postnote}
First use of the citation.\footnote{Some text: \textcite{PC-2014-Childcareearlychildhood}.}

The post-notes in the footnotes should be lower-case.\footcite[][14--15]{PC-2014-Childcareearlychildhood}

Here, the roman numerals are fine, but not the abbreviation for `page'.\footcite[][XXV]{PC-2014-Childcareearlychildhood}

Between 2011 and 2016, half of all jobs growth was within the city centres and inner suburbs in both Melbourne and Sydney.%
\footnote{Melbourne residents in suburbs more than 20 kilometres from the CBD have fewer than three jobs nearby for every 10 residents, while those close to the city centre have access to nine jobs for every 10 residents, \citetitle{KellyDonegan2015-City-limits}.}
Knowledge-intensive businesses -- which tend to be the most productive, and which are growing fastest -- particularly benefit from clustering together in the centres of large cities.%
\footcite[][23--29]{KellyDonegan2015-City-limits}



\appendix

\chapter{Appendices and back matter}\label{chap:appendices}
Expand Down
16 changes: 16 additions & 0 deletions bib/put-new-refs-here.bib
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,22 @@ @TechReport{MirrleesAdamBesleyEtAl2011
url = {https://www.ifs.org.uk/publications/mirrleesreview/},
}

@TechReport{PC-2014-Childcareearlychildhood,
author = {{PC}},
title = {Childcare and early childhood learning},
year = {2014},
institution = {{Productivity Commission}},
}

@Book{KellyDonegan2015-City-limits,
author = {Jane-Frances Kelly and Paul Donegan},
title = {City Limits: Why Australia's cities are broken and how we can fix them},
shorttitle = {City Limits},
year = {2015},
address = {Melbourne},
publisher = {Melbourne University Press},
}


@Misc{Budget2017-18-BP1,
author = {{Treasury}},
Expand Down
4 changes: 2 additions & 2 deletions doc/checkDocumentation.R
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,10 @@ if (!file.exists("grattexDocumentationMD5") ||
if (toupper(.Platform$OS.type) == "WINDOWS") {
shell("pdflatex -halt-on-error grattexDocumentation.tex")
} else {
system("pdflatex -halt-on-error grattexDocumentation.tex")
system("pdflatex -halt-on-error -interaction=scrollmode grattexDocumentation.tex > /dev/null")
}

if (!res) {
if (res) {
stop("Nonzero exit status from pdflatex.")
}

Expand Down
Binary file added doc/figure/Edit-travis-for-release.PNG
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added doc/figure/edit-travis.PNG
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added doc/figure/github-settings-tab.PNG
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added doc/figure/passing.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
8 changes: 6 additions & 2 deletions grattan.cls
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
\NeedsTeXFormat{LaTeX2e}
\ProvidesClass{grattan}[2017/11/03 v1.3.2 Reports of the Grattan Institute, Melbourne]
\ProvidesClass{grattan}[2018-02-26 v1.3.3 Reports of the Grattan Institute, Melbourne]
% >gswin64 -dBATCH -dNOPAUSE -sDEVICE=png16m -r300 -sOutputFile=./tests/Report%03d.png Report.pdf
% for png files
\LoadClass[%
Expand Down Expand Up @@ -953,7 +953,11 @@ numbers=noenddot,
\DeclareCiteCommand{\footcite}[\mkbibfootnote]
{\boolfalse{cbx:parens}}
{\usebibmacro{citeindex}%
\ifciteibid{Ibid.}{% % for ibidem
% https://github.com/grattaninstitute/AP-Housing-affordability-2017/commit/55757ed2c625d4e18ada5a71edfdb5fbd88f56d1
% Ibid. -> Ibid\adddot
% Otherwise the . in Ibid. is interprted as the end of a sentence
% which means the first letter in a postnote will be uppercase
\ifciteibid{Ibid\adddot}{% % for ibidem
\iffirstcitekey
{\setcounter{textcitetotal}{1}}
{\stepcounter{textcitetotal}%
Expand Down
Binary file modified tests/Report005.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified tests/Report006.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified tests/Report017.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified tests/Report018.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified tests/Report019.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified tests/Report020.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified tests/Report021.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified tests/Report022.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified tests/Report023.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified tests/Report024.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
15 changes: 15 additions & 0 deletions tests/test_grattex.R
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
if (nzchar(Sys.which("pdftotext")) && file.exists("Report.pdf")) {
system("pdftotext -layout Report.pdf")
library(data.table)

Report.pdf <-
data.table(pdf_lines = readLines("Report.txt", warn = FALSE, encoding = "UTF-8"))


# Issue 102
Ibid_lines <- Report.pdf[grepl("Ibid. (P", pdf_lines, fixed = TRUE)]
if (nrow(Ibid_lines)) {
stop("Ibid contains a page reference with uppercase P.")
}
cat("OK\n")
}
2 changes: 1 addition & 1 deletion travis/grattanReport/md5/bib/put-new-refs-here.bib
Original file line number Diff line number Diff line change
@@ -1 +1 @@
1bd3c1e75d83f9f881f75435b13ad606
6faf6a9d5797651ab7f2d8b99e13d327

0 comments on commit 5e1e90d

Please sign in to comment.