8

For some time now I'm tracking my tasks and ToDos (privately and for work) with Emacs org-mode( http://orgmode.org/ ) and I am very happy with it.

There is a large project in my life (my Ph. D. thesis), for sure written with LaTeX on MacOS X :-) , which creates a lot of todos related to my writing. In the past I have tried different approaches with limited success, to add notes and todos directly to my LaTeX source code and display them in the PDF for review and action. The problem was, that there was no external list where I could re-arrange, tag or prioritize those tasks and remarks.

Now, as I'm finally starting to like Emacs (which I never had used before org-mode), I wonder if I could use Emacs AucTEX for editing and compiling my large document and directly inserting notes in the source code, which I could keep track of with org-mode.

  • Does anyone do that or is there a tutorial to do so?

  • I assume that just inserting org-mode lines like * TODO [#B] rewrite this section"would conflict with LaTeX code.

  • Maybe there is a way to create kind of a permanent anchor at the current position in the LaTeX code and create an org-mode ToDO in my org-files which contains a hyperlink that lets me jump later (and even if the .tex file has changed) directly from org-mode to the place in the LaTeX source, where I want to edit something later?

  • It would be great, if I could add a note which is shown in the LaTeX pdf directly and link the corresponding line/place in the .tex source with a TODO in an org-file
2
  • I don't quite understand what you want. There is no way to make a software edit your LaTeX-file based on an orgmode data basis without at least a kind of reference between orgmode- and LaTeX-file. So you have to administer your TODO notes in the LaTeX-file by yourself. But what seems (sorry, I'm no programmer) possible is to make a macro write all your todos into a file in a form which can be read by orgmode, as well as into the margin of a certain page. Maybe you start with the package tocbasicor with todonotes.
    – Keks Dose
    Oct 8, 2012 at 13:44
  • thanks, an automatic export of existing todonotes (or similar) would also be an interesting option. In general, I want a possibility to create a TODO in org-mode from within AucTeX which lets me jump directly to the corresponding line in the source code later. Oct 8, 2012 at 14:26

2 Answers 2

5

org-insert-link is your friend in this. Bind it to a useful key globally, like C-c l, which you can use in your LaTeX file under AucTeX. The anchor inserted by org-insert-link isn't exacly permanent if you mess with the file enough, but it works most of the time.

A different solution would be to write your thesis in Org, including the ToDo's, and export to LaTeX.

Here's an MWE, except the link won't work because you don't have the LaTeX file I'm linking to.

#+TITLE:     Some links to a LaTeX doc
#+OPTIONS:   H:3 num:t toc:t \n:nil @:t ::t |:t ^:t -:t f:t *:t <:t
#+OPTIONS:   TeX:t LaTeX:t skip:nil d:nil todo:t pri:nil tags:not-in-toc


* This is an ordinary heading

This is a link to a context in a \LaTeX{} file with
[[file:~/Dropbox/_support/LSM2241/L7/LSM2241-AY201213-S1-L6-Feedback.tex::\section*{Q6%20How%20can%20the%20delivery%20of%20the%20material%20be%20altered%20to%20enhance%20your%20understanding%20of%20the%20material?}][some
helpful linky text]]. Note that the link keeps a bit of context,
which is created by running ~org-store-link~.

I have org-store-link globally bound to ~C-c l~ in emacs. Once the
link is stored, just insert it with org-insert-link


* TODO [#B] Finish this section

This *TODO* heading prints the *TODO* mark when the ~todo:t~
property at the top of this file is enabled. The template is
inserted with ~C-c C-e t~

* But honestly?

Why not just write your thesis in Org and export to \LaTeX{}
instead of keeping separate files?
7
  • 1
    thank you very much! I'll try that and give you a feedback. Oct 8, 2012 at 14:24
  • Sorry for my late reply. I just tried your suggestion and I'm not sure how to handle it properly: I'm using the capture templates from this site doc.norang.ca/org-mode.html#CaptureTemplates so I can with Cmd-Alt-R create a new Todo-Line in an org-mode buffer, which contains a link to the cursor position in the current text file, however if there is no selection, the link will point to the heading before (not precise enough in my large LaTeX files!). If I select some words, the link will point to those words. But it those words occur several times in the document, the link will point Dec 30, 2012 at 13:30
  • 1
    thanks for explaining! I imagine a feature which inserts at the position a short string with a unique ID as an anquor... but that seems not to be built-in in Emacs? Jan 2, 2013 at 8:36
  • 2
    Org won't alter a non-Org (e.g., AUCTeX) file buffer, but it will insert some text from the AUCTeX buffer into the Org buffer so you can return to it. The problem is if you then alter the text in the AUCTeX buffer that serves to anchor the link, the anchor will break. You could always write your entire thesis in Org mode, add your thesis files to your org-agenda-files, and keep your TODOs directly with the source, just exporting the LaTeX.
    – GTK
    Jan 2, 2013 at 12:12
  • 1
    thanks. For writing in org-mode it is too late, there is too many things "implemented" in LaTeX already, so I don't see how to go back to org for writing (missing formula previews, etc.). For the anchor: the problem is not only altering the linked text but also duplicates, if the anchor is not unique, as I mentioned above. Anyway, it helps me and I'm using it like that now to create org-todos linked to my LaTeX source Jan 4, 2013 at 8:33
3

From the Orgmode manual:

file:sometextfile::NNN                    file, jump to line number
...
file:projects.org::some words             text search in Org file

Even though the manual talks about searching "org files" for the latter case, if you link it to a non-org type, it will do a text search. That's what @GTK's example uses.

1
  • Yes, works. I just take the labels from my *.tex file and put a link to them from my org file.
    – Keks Dose
    Nov 30, 2017 at 15:54

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .