Take the 2-minute tour ×
TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

I am writing my PhD thesis and as I am not the least chaotic guy I also add notes for future reference. Surely, this means it is not production grade, or how you would like to call it.

There is a nice package called versions which takes care of the versions. We also have the helpful answers in Using latexdiff with git to use git. My goal now is to have something similar to versions but that the content is removed when for example it is in between \advisorcannotsee and \allokay and this would be checked out in the advisorbranch. Preferably, only the main version should be compiled (or the one marked as to be compiled).

Would such a thing already exist, or are there better solutions for this problem?

Per request:

Example workflow:

  1. I have a git repository working on the working directory of my thesis which includes all my remarks using \input or whatever.
  2. I have several branches other than the main branch, say paper1 and advisor which contains the same as the main branch (which contains it all) but then pieces cut out.
  3. I modify my document and I add things which are for my eyes only (main) and some which are for my advisor. I would like to use something like the versions package to mark parts which belong to where.
  4. When done editing I commit my changes. As my modification has parts which belong to a different branch I would like to have that the version which is okay for the advisor gets "built" (pieces cut out) and commited to advisor and the whole thing to main.
share|improve this question
1  
I don't quite understand what you are asking. Could you perhaps elaborate on how you see this workflow working so that we can see more clearly what you mean? –  Seamus Oct 8 '12 at 16:25
    
Thanks. I have added a possible workflow! I hope it makes more sense now. –  Jonas Teuwen Oct 8 '12 at 16:49
1  
Experience suggests that mixing version control (with git) and edition control (with versions, todonotes, and suchlike) can lead one into considerable difficulties (if for exxample you try to control editions through the git branch mechanism). I'm sorry; I'm away from home and my workbench, so I can't write you a fuller answer this week, but I'll have a go at it when I get back. There are good, and simpler (IMO) solutions. –  Brent.Longborough Oct 8 '12 at 17:05
    
@Brent.Longborough I am looking forward to it :-). –  Jonas Teuwen Oct 8 '12 at 17:08
    
As far as I can see, your question can be entirely solved by a moderately advanced usage of git (branches, cloned repo, etc.), so I'd suggest you to ask that question on StackOverflow. –  Olivier Oct 8 '12 at 19:17
show 6 more comments

1 Answer

up vote 10 down vote accepted

To begin, a couple of definitions:

Revision: One particular state of the files in a project, positioned along one or more lines of history

Edition: One particular variation which has a purpose in being different from other variations

(Notice that I have avided using the word "version"; it's too ambiguous, and will only occur here, if at all, in talking about "version control systems".)

I believe, strongly, that using different Revisions (probably on different branches of a VCS) is not a good way to manage Editions. Personal, embarrassing experience suggests that when branches are created that are not meant ever to merge back together, changes on one branch can get forgotten, or included by mistake, when a change needs to be incorporated in multiple editions.

A far better method is to create a configurable master file, and to include it from a series of top-level files, one for each Edition that is required.

Here is an example with three Editions. It is a very simple exam paper which includes questions, answers, and notes, and uses Viktor Eijkhout's comment package and Hendrik Mittby's todonotes package. You may find other packages more useful for your particular case.

To keep it simple, I haven't used any exam- or Q&A-related packages, just Enrico Gregorio's kantlipsum to pad it out a bit. Please bear in mind that this isn't meant to be an example of "Great Typography", just an illustration of general principles for making polymorphic editions.

The three editions are:

  1. The student edition: questions only
  2. The examiner edition: questions and guidelines for answers
  3. The supervisor edition: questions, guidelines for answers, and my notes to discuss the development of the exam with my supervisor.

The example consists of five TeX files:

Student.tex:

\documentclass[disable]{memoir} % [disable] is passed to todonotes
\input{preamble}
\excludecomment{answers}
\input{master}

Examiner.tex:

\documentclass[disable]{memoir}
\input{preamble}
\includecomment{answers}
\input{master}

Supervisor.tex:

\documentclass{memoir}
\input{preamble}
\includecomment{answers}
\input{master}

preamble.tex:

\usepackage{kantlipsum}
\usepackage{comment}
\usepackage{todonotes}
\newcommand{\mynote}[1]{\todo[inline]{#1}}

master.tex:

\begin{document}
\section{Philosophy}

Compare and contrast Aristotle's view with that of Kant, expressed in the following quotation:

\begin{quote}
\kant[2]
\end{quote}

\mynote{Should that be Aristotle, or would Plato be more demanding?}

\begin{answers}
\textbf{Answer Notes:}
bear this in mind: \kant[2]
\end{answers} 
\listoftodos
\end{document}
share|improve this answer
    
Thank you! This is helpful. Also thanks for not forgetting it :-). –  Jonas Teuwen Oct 17 '12 at 16:09
    
@JonasTeuwen : Glad to be of help. I came home from my travels with much more work than I set out with, but I managed to find half-an-hour to knock that together. –  Brent.Longborough Oct 17 '12 at 19:35
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.