4

I'm trying to highlight a syllable within a word in order to show that it is different from another word. How can I do this with * in org-mode and then properly export to LaTeX?

I'm on Windows 7 32-bit, Emacs 24.4.1 (i686-pc-mingw32), Org-mode version 8.2.10. I have followed the instructions on this page but something went wrong with Org -- it thinks an *.org file is a LaTeX file! I therefore had to comment out those lines in my .emacs configuration file. The lines I'm talking about are these:

(setcar org-emphasis-regexp-components " \t('\"{[:alpha:]")
(setcar (nthcdr 1 org-emphasis-regexp-components) "[:alpha:]- \t.,:!?;'\")}\\")
(org-set-emph-re 'org-emphasis-regexp-components org-emphasis-regexp-components)

I don't know why, but they don't work with my emacs. Are they still valid? Can anyone help me out, please? By the way I have this same question open on StackOverflow (here)

Screenshots

This is the structure of vocab.org. It has LaTeX tags at the bottom of the file so that when I export only the body as vocab.tex, it doesn't have problems recognizing vocab-main.tex as its master file. vocab-main.tex is a file containing all the font and page formatting that make the final pdf look good to the eyes.

vocab.org file structure

WobblyWindows
  • 325
  • 3
  • 14
  • Can you switch to org-mode? (`M-x org-mode`) – JeanPierre Dec 28 '15 at 22:42
  • Yes that works...temporarily only! At every restart of emacs, the problem reappears -- the text is white (I have opted for a dark emacs color-theme), as if it's plain text, no special Org-mode hooks applied to it. How do I fix it for good? – WobblyWindows Dec 29 '15 at 13:20
  • I don't know what's going wrong here but another solution is to use a zero width space character as described [here](http://emacs.stackexchange.com/questions/18499/mark-up-only-part-of-a-word/18511#18511) – JeanPierre Dec 29 '15 at 14:54
  • 1
    From this discussion, it sounds like what you really want to do is have `*.org` files open in `org-mode` by default, is this correct? If so, you can add `(add-to-list 'auto-mode-alist '("\\.org\\'" . org-mode))` to your init file – elethan Dec 29 '15 at 14:56
  • @elethan I don't have a proper configuration for Org-mode since I usually work with AUCTEX but please have a look at my _.emacs_ file (see above). I placed the new lines right at the bottom. Is it correct? Maybe that's the problem. – WobblyWindows Dec 29 '15 at 16:12
  • @WobblyWindows, you shouldn't need any further configuration aside from `(add-to-list 'auto-mode-alist '("\\.org\\'" . org-mode))` to get `*.org` files to open in `org-mode`. Basically, you will get the effects of `M-x org-mode` in org files, without having to explicitly switch to `org-mode` This is what you want to do, right? Please correct me if I am mistaken. – elethan Dec 29 '15 at 16:40
  • Yes, I want any *.org file to be automatically recognized and I want the corresponding hooks and styles be applied to the file. However, I've tried shutting and restarting Emacs after updating and saving the _.emacs_ file as you said -- it's still giving trouble, **that** particular org file appears as plain text, instead of Org-mode file so each time I must type `M-x org-mode` – WobblyWindows Dec 29 '15 at 17:13
  • Call the help on the variable `magic-mode-alist` and report its value in your post. You get the help on variables with the key-combination `C-h v`. Note, that positive matches of the regular expressions and predicates in `magic-mode-alist` override `auto-mode-alist`. – Tobias Dec 29 '15 at 18:33
  • Since the entry `("\\.org\\'" . org-mode)` is already in my `auto-mode-alist` when I start emacs with the option `-Q` I do **not** think that you need the setting `(add-to-list 'auto-mode-alist '("\\.org\\'" . org-mode))` in your init file. Just try it for yourself. Start emacs with `-Q` and check wether you find the `org` extension in `auto-mode-alist`. – Tobias Dec 30 '15 at 10:16
  • @Tobias Help on `magic-mode-list` returns: "magic-mode-alist is a variable defined in `files.el'. Its value is nil This variable may be risky if used as a file-local variable." – WobblyWindows Dec 30 '15 at 10:46

1 Answers1

6

The figure you added in the question explains everything! You have the line

mode: latex

in your file-local variables of the file vocab.org. And latex-mode is exactly what you get!

If you need these lines in your org-file you should add a line with only the special form-feed character ^L in it right after #+END_LATEX. You can input the form-feed character by typing C-q C-L or C-q C-l (after C-q uppercase or lowercase letter L with control key pressed).

File local variables are searched from the end of the file. The form-feed character limits this search forcefully.

The end of your file should look like in the following picture. Note the ^L in the picture! It should be marked by some color as control character.

enter image description here

Tobias
  • 32,569
  • 1
  • 34
  • 75
  • Wait a minute, I lost you there. How should it look then? `#+BEGIN_LaTeX: %%% Local Variables: %%% mode: latex %%% TeX-master: "vocab-main" %%% End: #+END_LaTeX ^L` Is it correct? Is `^L` on the following new line? 'Cause it still doesn't see it as an org file and I have to type `M-x org-mode`... – WobblyWindows Dec 30 '15 at 11:11
  • Yes, the character sequence is `(insert "\n\014\n")` in lisp. – Tobias Dec 30 '15 at 11:16
  • Just saw your edit. Re-wrote those tags, now things seems fine. – WobblyWindows Dec 30 '15 at 11:18