Re: [O] Questions about exporting: subtitle, level formating, custom highlight markers error
Hi John, Yes, highlight-regexp looks good and simple, when I apply it manually to the buffer. No need even to define a new face as the default hi-yellow is what I want. But: (how) can I call highlight-regexp from my .emacs file so that it automatically applies to every Org buffer? Or must it be called on a per buffer basis? Just putting (highlight-regexp ·[^·]*·) in my .emacs, as well as (global-hi-lock-mode 1) because Emacs throws a warning otherwise, didn't work. Once I find time to go through this elisp/customization tutorial http://emacslife.com/how-to-read-emacs-lisp.html I may more fruitfully study your post! thanks On 07/28/2015 05:19 PM, John Kitchin wrote: You may find this post on highlighting text helpful: http://kitchingroup.cheme.cmu.edu/blog/2015/07/28/A-highlight-annotation-mode-for-Emacs-using-font-lock/ I think it also lays the foundation for thinking about how to get it to export, although you would need to do this as a preprocessing step before the org export to replace highlighted regions by the appropriate markup. It also sounds like you could use the highlight-regexp function for what you want. Something like this might do what you want (use the face you prefer). (defface my-face3 `((t (:inherit org-link :foreground red))) My face) (highlight-regexp ·[^·]*· 'my-face3) (unhighlight-regexp ·[^·]*·) Xiha writes: ·test· Thanks guys. Getting closer - but please don't overestimate my backgound knowledge :) On 07/28/2015 02:05 PM, Eric S Fraga wrote: You need to differentiate between two aspects: highlighting of text within a org buffer and what happens to text when exported. Yes. Principally, I want the former. As to the latter: (1) my custom highlighting shouldn't break exporting. (2) /If/ highlighting can appear in the exported document, that's a bonus. But clearly it's not trivial to do; so never mind. In the new exporter, I don't think you can implement anything that covers both use cases. I am not entirely sure what it is you want. If you want just one of these, for the former, font-lock-add-keywords is probably what you want to pursue. Right, so grabbing code from the manual about font lock mode https://www.gnu.org/software/emacs/manual/html_node/emacs/Font-Lock.html, how do I adapt it? I tried putting this in my .emacs file ;; Highlight text between ·interpuncts· (add-hook 'org-mode-hook (lambda () (font-lock-add-keywords nil '((·\w· 1 font-lock-warning-face t) but that doesn't work. Probably that regexp is all wrong? Also, I don't want it to use font-lock-warning-face particularly. (How) can I define a new face for this purpose? Nick Dokos wrote: Emphasis is detected in the parser, so it is indeed difficult to add new emphasis for export. Since you don't care about the added emphasis in the exported document (only in the org buffer), using latest org from git works OK, So do I understand correctly that this is a completely different route than the font-lock-add-keywords one above? I.e. using this latest git version, I can define the highlight marker as I did and described earlier, and there's no need for a new face, because it uses the 'highlight' defined in the theme I'm using. Correct? I cloned the git files, but I'm wary of the next steps. If I just make and make install, will it not half-overwrite my current stable Org, and become a big mess? Sorry, this stuff is new to me and not really obvious. Also: I tried reinstalling Org via the menu, Options Manage Emacs Packages in hopes that it would install the git version while taking care of avoiding a mess. It now lists 20150727 as the version, so that's recent, but is that the 'bleeding edge' version or the stable version at that date? It didn't solve the problem, at any rate. except that the marker characters are copied verbatim to the output, so you'll have some cleanup to do. That's okay. It's not a problem for draft versions of the document; and by the time the final document is ready, all this temporary highlighting should be gone! I also tried 8.2.9 and got an error, but the error is different from what you get (backtrace attached). I am using 8.2.10 not 8.2.9 so that may explain the difference. cheers -- Professor John Kitchin Doherty Hall A207F Department of Chemical Engineering Carnegie Mellon University Pittsburgh, PA 15213 412-268-7803 @johnkitchin http://kitchingroup.cheme.cmu.edu
Re: [O] Questions about exporting: subtitle, level formating, custom highlight markers error
Thanks guys. Getting closer - but please don't overestimate my backgound knowledge :) On 07/28/2015 02:05 PM, Eric S Fraga wrote: You need to differentiate between two aspects: highlighting of text within a org buffer and what happens to text when exported. Yes. Principally, I want the former. As to the latter: (1) my custom highlighting shouldn't break exporting. (2) /If/ highlighting can appear in the exported document, that's a bonus. But clearly it's not trivial to do; so never mind. In the new exporter, I don't think you can implement anything that covers both use cases. I am not entirely sure what it is you want. If you want just one of these, for the former, font-lock-add-keywords is probably what you want to pursue. Right, so grabbing code from the manual about font lock mode https://www.gnu.org/software/emacs/manual/html_node/emacs/Font-Lock.html, how do I adapt it? I tried putting this in my .emacs file ;; Highlight text between ·interpuncts· (add-hook 'org-mode-hook (lambda () (font-lock-add-keywords nil '((·\w· 1 font-lock-warning-face t) but that doesn't work. Probably that regexp is all wrong? Also, I don't want it to use font-lock-warning-face particularly. (How) can I define a new face for this purpose? Nick Dokos wrote: Emphasis is detected in the parser, so it is indeed difficult to add new emphasis for export. Since you don't care about the added emphasis in the exported document (only in the org buffer), using latest org from git works OK, So do I understand correctly that this is a completely different route than the font-lock-add-keywords one above? I.e. using this latest git version, I can define the highlight marker as I did and described earlier, and there's no need for a new face, because it uses the 'highlight' defined in the theme I'm using. Correct? I cloned the git files, but I'm wary of the next steps. If I just make and make install, will it not half-overwrite my current stable Org, and become a big mess? Sorry, this stuff is new to me and not really obvious. Also: I tried reinstalling Org via the menu, Options Manage Emacs Packages in hopes that it would install the git version while taking care of avoiding a mess. It now lists 20150727 as the version, so that's recent, but is that the 'bleeding edge' version or the stable version at that date? It didn't solve the problem, at any rate. except that the marker characters are copied verbatim to the output, so you'll have some cleanup to do. That's okay. It's not a problem for draft versions of the document; and by the time the final document is ready, all this temporary highlighting should be gone! I also tried 8.2.9 and got an error, but the error is different from what you get (backtrace attached). I am using 8.2.10 not 8.2.9 so that may explain the difference. cheers
Re: [O] Questions about exporting: subtitle, level formating, custom highlight markers error
Thanks Sebastien and Eric, On Tuesday, 28 Jul 2015 at 09:24, Sebastien Vauban wrote: Eric S Fraga e.fraga at ucl.ac.uk writes: [...] You can always use macros instead? Maybe, if I knew how. I haven't used macros before. I read this http://orgmode.org/manual/Macro-replacement.html and tried #+MACRO: hi ·$1· Let's {{{hi(test)}}} this. but unsurprisingly that gives the same export error, and moreover within Org does not show the 'highlight' formatting I associated with ·, but rather the macro formatting. Or did you mean to simply use the fact that any macro gets 'highlighted' within Org -- so I should use something like #+MACRO: hi $1 ? Or the `font-lock-add-keywords' mechanism? In what way? What I read here https://www.gnu.org/software/emacs/manual/html_node/elisp/Customizing-Keywords.html seems more about highlighting particular words, not /any/ words between particular markers...? I think the OP wanted markers that would export, not just stand out in the emacs buffer. Most importantly, I would like to custom-highlight text /within/ Org, to make my writing easier. The highlighting nor the markers have to be in the exported document. But if they are there, that is icing on the cake. I figure - perhaps wrongly! - that it should be easiest to have custom marking like ·this· be highlighted within Org, yet be exported literally, without highlighting (i.e. '·' is treated just like any old character by the exporter)? cheers
Re: [O] How to escape [ and ] characters in org-mode links
Hi Dmitry, org-mode has the following format for links: [[file-name::text-to-search][link text]] What should I do, if text-to-search contains ']' symbol? Like this: $form['input'] Not sure it helps in your case, but this * Heading containing [brackets] * Other heading Here is a link to [[Heading containing *%5B*brackets*%5D*][that first heading]]. works for me.
Re: [O] Questions about exporting: subtitle, level formating, custom highlight markers error
Thanks Rasmus and Eric! 1) subtitle The git version has a #+subtitle keyword. See the git version of the manual for supported backends (most). Where the git install instructions say you should edit local.mk to point to the appropriate install location, how do I find out where this is? Sorry, not used to using git :/ Is it possible to install the git version alongside the stable one, and choose which to use for each session? 2) level formating For LaTeX export, this will not work (AFAIK) as LaTeX only supports 4 or so levels of headings. Just tested: yes, 5 levels. At the 6th it treats them as list items. Well, it may be sufficient - I put '9' to leave some room. Depends on the backend. With latex you could use setkomafont (of KOMA-Script) and with html you could use css. If you want this kind of control, you should ensure that the LaTeX uses the scrartcl (koma-script) article class which is highly configurable. However, you will have to do the LaTeX configuration yourself directly using #+latex: and #+latex_header: org directives in your org document. For HTML export, you will need to define the appropriate CSS specifications to achieve the stair case effect. I have no idea how this would be done... Right, I'll have a look at koma-script. Would there be a tutorial/example somewhere for how to do this from Org? And perhaps this can take care of the subtitle issue, too, within the stable Org version? 3) Custom highlight markers error No idea about this. It could be a bug anywhere. Could you maybe post a small example file? I have no idea what you are describing unfortunately. I retrieved what I did, from here http://stackoverflow.com/questions/20016634/highlight-selected-text-in-emacs-org-mode: You can re-define the characters for emphasizing via Options-Customize Emacs-Specific Option then input org-emphasis-alist. Then I added an item to the list for using the interpunct character ·, resulting in [INS] [DEL] List: Marker character: * Choice: [Value Menu] Font-lock-face: (sample) bold [ ] verbatim [INS] [DEL] List: Marker character: / Choice: [Value Menu] Font-lock-face: (sample) italic [ ] verbatim [INS] [DEL] List: Marker character: _ Choice: [Value Menu] Font-lock-face: (sample) underline [ ] verbatim [INS] [DEL] List: Marker character: = Choice: [Value Menu] Font-lock-face: (sample) org-verbatim [X] verbatim [INS] [DEL] List: Marker character: ~ Choice: [Value Menu] Font-lock-face: (sample) org-code [X] verbatim [INS] [DEL] List: Marker character: + Choice: [Value Menu] Face property list: [INS] [DEL] Key: :strike-through Value: t [INS] [ ] verbatim *[INS] [DEL] List: ** **Marker character: · ** **Choice: [Value Menu] Font-lock-face: (sample) highlight ** **[X] verbatim* Then when I write something like ·this· in my text, it is highlighted with a yellow background, within Org. But upon exporting I get the error mentioned. It does not appear to be due to some interaction with other stuff in my document, because the error occurs even for a minimal document that has only ·test· in it. So, a bug as Rasmus suggests, or a matter of configuration? cheers
[O] Questions about exporting: subtitle, level formating, custom highlight markers error
Hello, I am writing a paper-like document in Org-mode, and experimenting with export to HTML and PDF (via LaTeX) in order to share drafts. Not sure yet what the final formatting will be. I am quite new to Emacs/Org-mode, know little about css and nothing about LaTeX. Using Emacs 24.5.1 and Org-mode 8.2.10 that came with it. 1) I would like the exported document to have a subtitle under the title in a smaller and/or lighter font. The latter requirement makes splitting the title with a newline not quite a solution. I believe I saw discussion somewhere about a #+SUBTITLE keyword for LaTeX or HTML export (as opposed to Texinfo which the manual says is supported?) But that seemed to be a feature-in-progress? What is the status of this? Is there an alternative I can use for now? 2) I have #+OPTIONS: H:9 num:9 because explicit level structure is important for this document. I would like to have more control over how this is exported, e.g. by setting heading font size as well as left-margin widths per level, for a staircase-like effect similar to that obtained with org-indent-mode in Org itself. (How) can this be done? 3) I forget through which command/menu, but I set custom markers that 'highlight' the words they surround, within Org itself. I'm using the 'leuven' theme which makes them stand out with a yellow background - useful for passages that need work etc. But now when I try to export to HTML or PDF, it fails with Unknown marker at 10497. Is there a way to get the highlighting in the exported document? Alternatively, can I tell the exporter to ignore the custom markers, i.e. treat them as regular characters? Thanks in advance.