Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Checks for common latex mistakes #22

Open
suyashmahar opened this issue Apr 19, 2022 · 2 comments
Open

Checks for common latex mistakes #22

suyashmahar opened this issue Apr 19, 2022 · 2 comments

Comments

@suyashmahar
Copy link
Member

Some of our published papers have mistakes where

  1. Figure is not referenced in the text
  2. References are missing (?) in the paper

Latex warnings are next to useless in most cases since they are hidden in a wall of text. Maybe we should -Werror or something in submission mode (#12)

@suyashmahar
Copy link
Member Author

latexmk supports werror:

   -Werror
         This causes latexmk to return a non-zero status code if any of the files processed gives a warning about  problems  with  cita‐
         tions  or references (i.e., undefined citations or references or about multiply defined references).  This is after latexmk has
         completed all the runs it needs to try and resolve references and citations.  Thus -Werror causes latexmk to treat  such  warn‐
         ings  as errors, but only when they occur on the last run of (pdf)latex and only after processing is complete.  Also can be set
         by the configuration variable $warnings_as_errors.

@suyashmahar
Copy link
Member Author

Diff to highlight missing references and citations

diff --git a/Make.rules b/Make.rules
index d02895e..8e1173e 100644
--- a/Make.rules
+++ b/Make.rules
@@ -73,7 +73,7 @@ pdf: $(PDF_TARGETS)

 %.pdf %.log %.aux: %.tex $(TEX_FILES)
        $(LIBPAPER_BIN)/texlint $(TEXLINT_OPTS) $^ --ignore-files $(TEXLINT_IGNORE)
-       $(LATEXMK) $(LATEXMK_OPTS) -pdf -pdflatex="$(PDFLATEX) $(PDFLATEX_BATCH_OPTIONS)" -use-make $*
+       $(LATEXMK) $(LATEXMK_OPTS) -pdf -pdflatex="$(PDFLATEX) $(PDFLATEX_BATCH_OPTIONS)" -use-make $* 2>&1 | awk '/Citation |Reference / { print "\033[31m" $$0 "\033[0m"} !/Citation |Reference / { print $$0 }'

Shows up as:
image

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant