Closed mofosyne closed 5 years ago
Thank you @mofosyne !
No probs! I'm still editing to see what I can do to make this more robust.
I am also wondering if I should also include these changes where I added this line iconv -c -f utf-8 -t ascii $(CHAPTERS) > $(BUILD)/pdf_prep_source
to strip out any unicode char.
$(BUILD)/pdf/$(OUTPUT_FILENAME).pdf: $(MAKEFILE) $(METADATA) $(CHAPTERS) $(CSS_FILE) $(IMAGES)
@echo ""
@echo "--- $@ building ---"
mkdir -p $(BUILD)/pdf
iconv -c -f utf-8 -t ascii $(CHAPTERS) > $(BUILD)/pdf_prep_source
pandoc $(ARGS) -V documentclass=$(LATEX_CLASS) -V geometry:margin=1in -o $@ $(BUILD)/pdf_prep_source
@echo "--- $@ complete ---"
This is since unicode chars seems to break this script. However you may have a better idea. (Or we can just require everyone to use --pdf-engine=xelatex
by adding it to the makefile)
--- build/pdf/XXX.pdf building ---
mkdir -p build/pdf
pandoc --toc --toc-depth=2 --webtex --css=style.css --metadata-file=metadata.yml --resource-path=./chapters -V documentclass=report -V geometry:margin=1in -o build/pdf/XXX.pdf ./chapters/introduction.md ./chapters/dev_board.md ./chapters/research.md ./chapters/contact.md
Error producing PDF.
! Package inputenc Error: Unicode character μ (U+3BC)
(inputenc) not set up for use with LaTeX.
See the inputenc package documentation for explanation.
Type H <return> for immediate help.
...
l.253 2.95 μ
Try running pandoc with --pdf-engine=xelatex.
make: *** [build/pdf/XXX.pdf] Error 43
Also on a side note, would it make sense to have a make install-req-ubuntu
etc... to make it easier to tell people how to install dependencies? Or would it be better to just make sure people follow the readme. Just thinking about the useability of this for semi-technical users.
Ah pandoc suggest xelatex because "it natively supports Unicode and the input file is assumed to be in UTF-8 encoding by default." But happy to hear your thoughts
Also, one other thing I changed that I have not pushed in, was that I moved the image folder to the chapter folder.
This is since I typically keep all the content in a source folder (./chapters/
). However, might be a little harder to integrate without switching to manual chapter includes.
My motivation is partially to ensure that when viewing the markdown files in github, you can still see the images.
edit: Just found that iconv -c -f utf-8 -t ascii $(CHAPTERS) > $(BUILD)/pdf_prep_source
has problems as shown below.
--- build/pdf/XXX.pdf building ---
...
iconv -c -f utf-8 -t ascii ./chapters/introduction.md ./chapters/architecture.md ./chapters/dev_board.md ./chapters/research.md ./chapters/reference.md ./chapters/contact.md > build/pdf_prep_source
make: *** [build/pdf/XXX.pdf] Error 1
Thus I now opt for inserting --pdf-engine=xelatex
, which seems to work okay enough. But does still complain about none unicode chars.
...
[WARNING] Missing character: There is no μ (U+03BC) in font [lmroman10-regular]:mapping=tex-text;!
--- build/pdf/XXX.pdf complete ---
Hello @mofosyne ! Thank you for your comments!
This is since unicode chars seems to break this script.
Didn't knew Unicode characters would break this.
Ah pandoc suggest xelatex because "it natively supports Unicode and the input file is assumed to be in UTF-8 encoding by default." But happy to hear your thoughts
That's nice. I'll make a commit updating both the Makefile and the README.md.
Also, one other thing I changed that I have not pushed in, was that I moved the image folder to the chapter folder.
I do not like this one, since the chapters folder should include only markdown files. Please note that the images
folder will be copies as is.
Please note that this is a basic template, and I'm trying to keep it as simple as possible. Any user can create the folder structure that they like the most. For example:
|- chapters
| |- act1
| | |- chapter1.md
| | |- chapter2.md
| | |- chapter2.md
| |- act2
| |- chapter2-1.md
|- assets
| |- images
| | |- seagull.png
| | |- robot.jpg
| |- stylesheets
| |- global.css
|- etc
|- ...
Thus I now opt for inserting --pdf-engine=xelatex, which seems to work okay enough. But does still complain about none unicode chars.
Looks like the default font (lmroman10-regular) does not have all unicode characters. It does not throw errors for characters like these: ǽߢð€đŋ
.
I'll try to check if there's a different font.
Made a few changes to the makefile to make it easier to read. Adjusted margin for pdf and also added a tip to the readme on how to have finer control over included files.