aiorazabala / qmethod

R package to analyse Q methodology data
GNU General Public License v2.0
34 stars 17 forks source link

Create make.cards template for double sided printed cards which can be cut out #354

Closed ebbertd closed 7 years ago

ebbertd commented 7 years ago

As a user I would like to have a template that creates a pdf which can be printed double sided so that the id is on the back of the full wording. This way the cards can just be cut out.

maxheld83 commented 7 years ago

I am unfortunately a little bit confused where I have implemented this (on my fork or here), but this is definitely already implemented. Just check out make.cards() here or on my fork: https://github.com/maxheld83/qmethod

ebbertd commented 7 years ago

@maxheld83 Would be great as it would save me work. However, I don't seem to be able to find it. The master only includes AveryZweckformC32010.Rnw, see https://github.com/aiorazabala/qmethod/tree/master/inst/cardtemplates And your fork adds the template 2x1a4.Rnw which doesn't seem to be the right one. Any idea as to where else you could have implemented it? Otherwise I'll just go on working on my version.

maxheld83 commented 7 years ago

@ebbertd I'm not quite sure I understand what you need.

There seem to be two unrelated issues here: two-sided / duplex printing and templates; they're unrelated.

re: templates

(This is the make.cards(paper.format = "AveryZweckformC32010.Rnw") argument).

2x1a4.Rnw and AveryZweckformC32010.Rnw refer to the paper formats that make.cards() can currently deal with. In other words: make.cards() can create (via LaTeX) smaller cards, which can be cut out from big A4 paper, and the smaller cards can either of the size A5 (2x1a4.Rnw) or they can be business cards ( AveryZweckformC32010.Rnw.). Other paper formats (say, legal) or other card sizes (say, game-cards) can be added in the same manner as some *.Rnw, though the LaTeX is a bit fiddly.


re: duplex

(This is the make.cards(duplex.double = FALSE) argument).

There is currently a function for printing duplex, though only in a somewhat limited / hacky fashion (from the docs):

\item{duplex.double}{
    Logical.
    If \code{TRUE}, \emph{page} is included \emph{twice} in the output to allow duplex printing, where duplex printer driver settings do not allow for such a setting.
    Defaults to \code{FALSE}, in which case each page is included only \emph{once} (recommended), and printer driver settings have to be used for duplex copying.
  }

This means: if you're cards are small enough so that you can lay them out 2 abrest (actually 2n abrest) on whatever paper format you're using, you can create duplex-ready PDF. This works in a somewhat hacky way: the full item is always on the left column, and the short item handle (or hash) is on the right hand column. If you then insert the same page again into the printer, face down, you get exactly what you want: full items on front of each card, short item handle on the back of each card. The above duplex.double argument is quite crude: it just repeats each PDF page twice, so that it can be directly sent to a duplex printer, without manually taking it out and printing the other side again. It's quite the hack, but it works.

Attached is a picture of how the completed PDF looks, when printed out. Same thing from the back.

img_1028

So bottom line: this is implemented (albeit hackily), if you can organize cards abrest.

Hope this helps.

maxheld83 commented 7 years ago

other than this, I'm a bit pessimistic whether the current make.cards() can be meaningfully extended to other use cases. It's a pretty awful setup and horrible code, one of the first things I ever wrote.

I'm currently re-writing the whole card-printing stuff, based on pre-rendered *.svgs via LaTeX then placed together on arbitrary paper sizes via LaTeX minipage. (The *.svgs have the advantage that they can also be easily used on the web).

The current design in make.cards() works via longtables, which is quite disgusting.

maxheld83 commented 7 years ago

@ebbertd just occurs to me, if you're pressed for time and just need to make this work quickly, you could probably extend the use cases a little bit by scaling results to A3 or A5 or whatever, or by programmatically splitting up the PDF, though that would make for an even more disgusting procedure 😸

ebbertd commented 7 years ago

@maxheld83 Let me explain exactly what I did, maybe that clears up what I intended. They seem unrelated to you, but I mixed them up. As I wasn't aware of the duplex.double argument and can't find it in the documentation. Where is that documentation you cited? I tried to achieve a similar effect using a template. So I created a template which on the first page has the first 10 IDs and on the second page the first 10 full items and so. This then creates a pdf with alternating pages of IDs and full items which can directly be send to the duplex printer. But it seems that using the duplex.double argument would already have been enough for me. :)

maxheld83 commented 7 years ago

@ebbertd you can find the documentation by installing my fork: https://github.com/maxheld83/qmethod

You can install it with the usual:

install_github(repo = "maxheld83/qmethod")
library(qmethod)
help("make.cards")

If you install that fork, you can also use the duplex.double argument, though, as I said, it's a bit of a hack job.

The way you went about it also seems fine, actually seems cleaner than what I did. I remember I couldn't make that work programmatically, because I would never know where the longtable would pagebreak, and thus I couldn't create one PDF, which I wanted.

Anyway, I didn't mean to discourage any PR that you might think of, just wanted to add my experience here, and warn you about make.cards() (because it's a mess).

Hope that my new design will be much more elegant/robust/flexible, but that'll take some more time.

maxheld83 commented 7 years ago

This seems closeable, also https://github.com/QWrks/pensieve/issues/103

ebbertd commented 7 years ago

Oh yes it can be, I meant to continue working on it but there is indeed no need.