So, I started to use orgmode for writing the documentation for my latest software project. This means, that I have code blocks and lots of special characters in my document. I will have to export this whole file to LaTex/pdf, so my colleague can bind it into his project documentation and this is exactly where my problems are. First of all: how can I turn of the need to manually stop the code execution for code blocks when exporting? I have the single line src_bash{} blocks but also the multiline versions:

#+begin_src bash :
#code
#+ends_src

The next thing is, that my function names include underscores, which in orgmode translates to making the following text lowercase. I tried using \ to escape it, but that only breaks it in a new way and I seriously cant comprehend how this so called zero width space is supposed to be used.

  • flamingos-cant (hopepunk arc)@feddit.uk
    link
    fedilink
    English
    arrow-up
    1
    ·
    2 days ago

    First of all: how can I turn of the need to manually stop the code execution for code blocks when exporting

    From the docs:

    You can prevent Org from evaluating code blocks for speed or security reasons:

    • To speed up export, use the header argument ‘:eval never-export’
    • For greater security, set the org-export-use-babel variable to nil, but understand that header arguments will have no effect in this case.

    The next thing is, that my function names include underscores, which in orgmode translates to making the following text lowercase.

    Do you mean subscript, like HELLOWORLD? Also from the docs:

    If you write a text where the underscore is often used in a different context, Org’s convention to always interpret these as subscripts can get in your way. Configure the variable org-use-sub-superscripts and/or org-export-with-sub-superscripts to change this convention. For example, when setting these variables to {}, ‘a_b’ is not displayed/exported as a subscript, but ‘a_{b}’ is.

    • da_cow (she/her)@feddit.orgOP
      link
      fedilink
      arrow-up
      1
      ·
      2 days ago

      For greater security, set the org-export-use-babel variable to nil, but understand that header arguments will have no effect in this case.

      That worked perfectly.

      Do you mean subscript, like HELLOWORLD? Also from the docs:

      Thats exactly what it is. I setted both of the mentioned variable to "{}" like this:

      (setq org-use-sub-superscripts "{}"
      
            org-export-with-superscripts "{}")
      

      however, when I write something like this: log_{critical}_{error}, it gets rendered like this: logcriticalerror

      • flamingos-cant (hopepunk arc)@feddit.uk
        link
        fedilink
        English
        arrow-up
        2
        ·
        edit-2
        2 days ago

        You need to use a symbol, not a string:

        (setq org-export-with-sub-superscripts '{}
              org-use-sub-superscripts '{})
        

        write something like this: log_{critical}_{error}

        That’s what you’d need to write to have subscript, with the above set:

        • log_critical => log_critical
        • log_{critical} => logcritical

        Edit: org-export-with-superscripts => org-export-with-sub-superscripts

        • da_cow (she/her)@feddit.orgOP
          link
          fedilink
          arrow-up
          1
          ·
          2 days ago

          So I have set them like this:

          (setq org-use-sub-superscripts '{}
          
                org-export-with-superscripts '{})
          

          and it still does not render correctly. Writing log_critical and log_{critical} gets rendered as logcritical

          • flamingos-cant (hopepunk arc)@feddit.uk
            link
            fedilink
            English
            arrow-up
            2
            ·
            edit-2
            2 days ago

            Weird, are they getting overridden by something else in your config (a package or something). In an org-mode buffer, what’s the output of C-h v org-export-with-sub-superscripts?

            Edit: worked out the issues, I wrote the one of the variable names wrong, it should be org-export-with-sub-superscripts not org-export-with-superscripts

            • da_cow (she/her)@feddit.orgOP
              link
              fedilink
              arrow-up
              1
              ·
              2 days ago

              That fixed it. :3

              May I ask you something else? Do you know how I can configure the layout of tables in Orgmode? Currently my table looks like this:

              What I am missing is a separator between each column. I tried out various things through the LaTex attributes as it has been described here, but most stuff either broke my caption or didnt change anything at all about the table. I have not configured my table anything beyond giving it a caption.

  • tal@lemmy.today
    link
    fedilink
    English
    arrow-up
    1
    ·
    edit-2
    4 days ago

    First off, while I like using org-mode for my own private documents, I’d recommend against it for use with other people for pretty much anything other than maybe emacs software. The problem is that org-mode is a continuously-evolving format that only really emacs fully implements, though there is some partial implementation by, say, vim and some other packages. That’s not great for an interchange format, since one can’t really expect other people who might work with the document to be emacs users.

    I’d be more-inclined, if one wants a pure-text-friendly format that will be exported to some sort of formatted form, to use something like AsciiDoc.

    But, okay. Set that aside. Say you definitely want to use org-mode. I don’t know how you’re doing the export, but you might try using Pandoc instead of emacs, which has its own implementation of org-mode and can export to PDF; people using Pandoc could use other editors. My guess is that Pandoc’s implementation most-likely doesn’t support executing code in the first place, which might indirectly avoid the problem in the first place.

    I’m not sure what you mean by underscores making text lowercase. I regularly type underscores in org-mode.

    EDIT: Maybe you have some other mode you have active making underscore do something special? You might hit C-h k _ in org-mode to see what the underscore key is invoking. On my system, it’s org-self-insert-command.

    • da_cow (she/her)@feddit.orgOP
      link
      fedilink
      arrow-up
      1
      ·
      4 days ago

      EDIT: Maybe you have some other mode you have active making underscore do something special? You might hit C-h k _ in org-mode to see what the underscore key is invoking. On my system, it’s org-self-insert-command.

      Thats exactly what is the case, is there any way to unbind it? Could not really find anything regarding that.

      • tal@lemmy.today
        link
        fedilink
        English
        arrow-up
        1
        ·
        edit-2
        4 days ago

        If it’s something other than org-self-insert-command — if you don’t mind sharing, posting what command it is running might help — you could unbind it. I used to use global-unset-key in old versions of emacs:

        ;; Emacs 21 uses M-g for facemenu, which I never use; better to make
        ;; it goto-line, as in later versions
        (if (< emacs-major-version 22)
            (progn
              (global-unset-key (kbd "M-g"))
              (global-set-key (kbd "M-g g") 'goto-line)))
        

        I’m not really familiar with keymaps, but I understand that there are a couple ways of binding keys, so that may or may not work.

        But I think that that’s probably not actually what you want to do. There’s probably some other mode binding _ to another command, and it’d be better to ask it to not bind to it (and maybe not even to be loaded, if you don’t like that mode).

        If you hit C-h k _, the name of whatever it’s bound to should give you some hint — usually, emacs commands tend to start with the name of the package, by convention. C-h m will also list your active modes, which might also tell you what the mode is.

        • da_cow (she/her)@feddit.orgOP
          link
          fedilink
          arrow-up
          1
          ·
          2 days ago

          When doing C-h k _ I get the following message:

          _ runs the command org-self-insert-command (found in org-mode-map),
          which is an interactive native-comp-function in ‘org.el’.
          
          It is bound to SPC..~ and \200..\300.
          
          (org-self-insert-command N)
          
          Like ‘self-insert-command’, use ‘overwrite-mode’ for whitespace in tables.
          If the cursor is in a table looking at whitespace, the whitespace is
          overwritten, and the table is not marked as requiring realignment.
          
          This function has :before advice: ‘org-fold-check-before-invisible-edit-maybe’.
          

          I also se the latest version of emacs (30.2)

          • tal@lemmy.today
            link
            fedilink
            English
            arrow-up
            1
            ·
            2 days ago

            Oh, nah, that’s the same function; it’s not bound to something else. Either I’m misunderstanding what you’re seeing or…oh. You were talking about writing function names.

            The next thing is, that my function names include underscores, which in orgmode translates to making the following text lowercase.

            Do you only see this behavior when writing function names or source code or something? Like, when you’re writing ordinary text in org-mode, hitting “_” doesn’t make the text lowercase?

            Like, do you have a snippet of text that causes the problem for you? I can look at that.

            I also se the latest version of emacs (30.2)

            I’m using 30.1, but I think that I’m probably just misunderstanding what you’re hitting.