satRdays / badgeR

badgeR R package
1 stars 3 forks source link

Abstract-out-template #18

Closed DaveParr closed 4 years ago

DaveParr commented 4 years ago

A simple method to abstract out the template tex string from the main body function.

In this method the package has a semi-compliant tex file, with syntax highlighting that can be opened and inspected independantly.

By doing this we open up the possibility of supplying an interface for users to provide custom tex templates (within reason + compliant with the glue interpolation mechanisims) to enable more customisation, such as portrait style badges etc.

This 'works' but the readLines + collapse feels minorly janky. Open to suggestions for improvement in reading in .tex but personally couldn't find a better solutions without increasing the dependencies of the package with other packages of semi-debatable quality. Would have thought knitr/tinytex might have had an internal tex reading method I could yank but couldn't turn anything up.

dokato commented 4 years ago

This looks actually exactly like something I had in mind. I didn't know it would be so easy with readLines. In general, I really like how it looks right already (apart from minor edits in the .tex template. The only confusing bit is ambiguity between latex curly brackets and glue curly brackets, but I guess we can live with that!

DaveParr commented 4 years ago

So do you want to merge this in, or shall I move some of the file location/ documentation?

dokato commented 4 years ago

Yes, we could merge that in. Just please fix the conflicts and address the issues above before, thanks :)