Skip to content
This repository has been archived by the owner on Sep 23, 2018. It is now read-only.

fix getDocumentPointsize to work with "a4paper" documentclass option #61

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

corecode
Copy link

@corecode corecode commented Aug 5, 2012

The previous regexp would match any number that was followed by either
"p" or "t" and use this as the document point size. This led to

\documentclass[a4paper]{artice}

being interpreted as a 4pt document. As a result, plotted figures
wound up with grossly scaled font nodes (scale=3 or similar).

We instead want to only match digits at the beginning of a word,
followed by the string "pt".

The previous regexp would match any number that was followed by either
"p" or "t" and use this as the document point size.  This led to

    \documentclass[a4paper]{artice}

being interpreted as a 4pt document.  As a result, plotted figures
wound up with grossly scaled font nodes (scale=3 or similar).

We instead want to only match digits at the beginning of a word,
followed by the string "pt".
@yihui
Copy link

yihui commented Apr 4, 2013

This is not a complete fix. I think you should use '\\<\\d+pt\\>' to avoid cases like 12ptabc. Accordingly there should be a change later in this function: increase 2 to 3 because pt has two characters

pointsize <- substr(docString, psLocation, psLocation + 
            attr(psLocation, "match.length") - 3)

@corecode
Copy link
Author

corecode commented Apr 4, 2013

Thanks, I fixed accordingly.

@ghost ghost assigned Sharpie Apr 20, 2013
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants