I use org-mode to translate, with source text lines on level 2 headlines and target text lines on level 3 headlines.

However, the text of any headline that is exported is bold and italicised. I can go through the exported document and manually remove this formatting but I was wondering if there was a way to remove this formatting in export? I can see org-export-filter-bold-functions, but no matter how I try to use it I can't make it un-bold etc. the exported text.

Do any of you fine souls know how to go about achieving this? I'm totally stuck!

  • What are you exporting to? Answers might differ depending on the export format (LaTeX will be different from HTML e.g.)
    – NickD
    Jun 3 '20 at 14:10
  • I'm exporting to odt. All I know is that when it exports, all the text is automatically bold and in italics.
    – Jtrans
    Jun 3 '20 at 14:22

You can remove the leading stars. This will prevent the exporter from formatting your headlines as headlines if that makes sense. In your case the easiest way of doing this is with the following advice:

(advice-add 'export-translation :after
            (lambda (backend)
               (lambda ()
                 (when (looking-at org-outline-regexp)
                   (replace-match "\n"))))))
  • Brilliant - this does exactly what I was looking for! By removing the leading stars it, as you say, exports them just as lines of text. Thanks for this, and sorry in general for posting so many probably quite silly and obvious questions - I know I keep saying it but I'm new to all of this and still in the stage of relying on others for help. Anyway, this is perfect - so thanks!
    – Jtrans
    Jun 3 '20 at 22:15
  • @Jtrans: Not silly at all. I'm glad it worked.
    – jagrg
    Jun 10 '20 at 21:38

There is a slightly more detailed description of what you are doing in your other question - I provide the link here just to clarify to potential answerers what you are trying to do.

Both of your questions basically ask: how can I force Org mode to do what I want? In the first one, you want to export part of the document: Org mode has facilities to export parts of the document, but the parts that you want to export and the parts that Org mode wants to export (e.g. a subtree) do not agree. In this question, you want to export headlines without making them appear as headlines: but they are called "headlines" for a reason and Org mode exports them to look like headlines.

What I am trying to say is that you are trying to force Org mode to do things against its nature, by mapping what you want onto its structures without regard for what it wants to do. The comments in your other question hint at this: you are probably not using the "right" Org mode structures to map your structures onto, and the fact that you have to fight Org mode to make it do what you want is an indication of that. You can probably make it do what you want, but you'll be fighting it all the way: it would be better if you rethought your approach to make the mapping more natural.

It may also be that Org mode is just not the right fit for your problem: it solves a lot of problems but it cannot solve every problem thrown at it. You might want to take a step back and ask yourself if you should use Org mode for this problem, or if maybe another tool is more suited for the job. Or you might ask if there is a better mapping to Org mode structures to do what you want.

In the latter case, I would suggest you post a different question here: describe what you want to do and ask whether Org mode (or something else) provides the structure(s) to help do what you want.

E.g. you say you use one kind of headline for the source text and a different kind of headline for the translation, but you don't say why you want to do that. Are you doing this e.g. because you want to exercise your skills in a foreign language (using the text as flashcards)? Or because you are translating a book and you want to store common phrases so that you translate them the same way each time? Or some other reason?

I realize that this does not provide an answer to your immediate question, but I hope it helps you think about the underlying problem.

EDIT (in response to the OP's comment): There are many ways to use a tool (and Org mode in particular is a multi-tool which makes things worse - or better, depending on your point of view). What I was suggesting is that if you described what you are trying to do (at a high level, not how you are doing it in the current implementation), somebody might come up with a better mapping (to Org mode or to a different tool). This might be a discussion that's not well suited for the Emacs SE format though: you might want to post the more general question on the Org mode mailing list which is better suited to exploratory, open-ended discussion.

  • Thanks for the response! I think I didn't realise that that's what I was doing because I'm basically learning as I go. I haven't got a good enough grasp of what org-mode is and does yet, and so I guess I hadn't understood that what I was trying to make it do was against what it wants to do. I'm working this way because it lets me keep the source, target and comments all in one place. The only problem is that I have to manually unbold after exporting, which is not really that big of a problem - so I'll keep using org-mode and just manually reformat it before I send it to the client. Thanks!
    – Jtrans
    Jun 3 '20 at 13:58
  • I added some more thoughts to the (non-) answer.
    – NickD
    Jun 3 '20 at 16:37
  • I agree (cc @Jtrans). Maybe keep the original sentence as a comment and add the translation below it.
    – jagrg
    Jun 3 '20 at 20:58

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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