emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
* Bug: Latex export of literal string containing "\__" produces unexpected output [7.5]
@ 2011-05-12  2:09 sharad shrestha
  0 siblings, 0 replies; only message in thread
From: sharad shrestha @ 2011-05-12  2:09 UTC (permalink / raw)
  To: emacs-orgmode; +Cc: sharad_shrestha


[-- Attachment #1.1: Type: text/plain, Size: 5547 bytes --]


Hi,
I have an Org file that contains a literal string of the form "str1\__str2". When I export it to Latex (for subsequently generating a pdf file), the generated .tex file contains unexpected (wrong) results.
To illustrate this problem, I have tested the following 8 literal string:
1)  str1\__str22)  str1\\__str23)  str1\_str24)  str1\\_str25)  str1\str26)  str1\\str27)  str1_str28)  str1__str2
I have defined each of these 8 literal strings in 5 different ways, as shown below using the literal string of test example (1) above:
Case (a)    : str1\__str2
Case (b)    #+BEGIN_EXAMPLE    str1\__str2    #+END_EXAMPLE
Case (c)    \verb+str1\__str2+
Case (d)    #+BEGIN_LaTeX    str1\__str2    #+END_LaTeX
Case (e)    \begin{verbatim}    str1\__str2    \end{verbatim}
I find unexpected (wrong) results for the following cases:
Example 1, Cases (c), (d), (e)Example 2, Cases (c), (d), (e)Example 4, Case  (d)Example 7, Cases (c), (d)Example 8, Case  (d)
The attached file "Latex-export-output.pdf" gives the output in the .tex file for each of the above 8x5 = 40 cases. It also contains what I consider to be the expected output.
Also attached is the Org file "Latex-export-problems.org" containing these test cases.
I have tested all these test cases with and without the following option in the Org file:#+OPTIONS:     ^:{}
Except for Case 7(c), for all the remaining 39 cases, including or not including this option does not change the resulting .tex output.
For Case 7(c), when this option is not used, the .tex file contains the following output:
\verb+str1$_{\mathrm{str2}}$+
When the option is not used, the .tex file contains the following output:
\verb+str1\_{}str2+
I gratefully appreciate your help in resolving this issue.
Thanks and Best Regards,
Sharad(sharad_shrestha@hotmail.com)

==============================================================
Emacs  : GNU Emacs 23.2.1 (i386-mingw-nt5.1.2600) of 2010-05-08 on G41R2F1Package: Org-mode version 7.5
current state:==============(setq org-log-done 'note org-remember-default-headline "Quick Notes" org-export-latex-after-initial-vars-hook '(org-beamer-after-initial-vars) org-speed-command-hook '(org-speed-command-default-hook org-babel-speed-command-hook) org-agenda-files '("~/.org/notes.org" "~/.org/JOURNAL.org" "~/.org/TODO.org" "~/.org/Personal.org" "~/.org/Molikpaq.org" "~/TODO.org") org-hook '((lambda nil (auto-fill-mode t) (setq fill-column 70) (setq fill-prefix nil))) org-metaup-hook '(org-babel-load-in-session-maybe) org-footnote-section nil org-after-todo-state-change-hook '(org-clock-out-if-current) org-export-blocks-postblock-hook '(org-exp-res/src-name-cleanup) org-export-latex-format-toc-function 'org-export-latex-format-toc-default org-tab-first-hook '(org-hide-block-toggle-maybe org-src-native-tab-command-maybe                      org-babel-hide-result-toggle-maybe) org-src-mode-hook '(org-src-babel-configure-edit-buffer org-src-mode-configure-edit-buffer) org-confirm-shell-link-function 'yes-or-no-p org-export-first-hook '(org-beamer-initialize-open-trackers) org-startup-indented t org-todo-keywords '((sequence "TODO" "FEEDBACK" "VERIFY" "MODIFY" "|" "DONE" "DELEGATED")) org-agenda-before-write-hook '(org-agenda-add-entry-text) org-default-notes-file "~/.org//notes.org" org-directory "~/.org/" org-babel-pre-tangle-hook '(save-buffer) org-cycle-hook '(org-cycle-hide-archived-subtrees org-cycle-hide-drawers                  org-cycle-show-empty-lines org-optimize-window-after-visibility-change) org-export-preprocess-before-normalizing-links-hook '(org-remove-file-link-modifiers) org-mode-hook '((lambda nil                  (org-add-hook (quote change-major-mode-hook) (quote org-show-block-all)                   (quote append) (quote local))                  )                 (lambda nil                  (org-add-hook (quote change-major-mode-hook) (quote org-babel-show-result-all)                   (quote append) (quote local))                  )                 org-babel-result-hide-spec org-babel-hide-all-hashes org-mode-reftex-setup                 (lambda nil (setq reftex-mode 1)) turn-on-font-lock) org-ctrl-c-ctrl-c-hook '(org-babel-hash-at-point org-babel-execute-safely-maybe) org-confirm-elisp-link-function 'yes-or-no-p org-export-interblocks '((lob org-babel-exp-lob-one-liners) (src org-babel-exp-inline-src-blocks)) org-occur-hook '(org-first-headline-recenter) org-from-is-user-regexp nil org-export-preprocess-before-selecting-backend-code-hook '(org-beamer-select-beamer-code) org-remember-templates '(("Todo" 116 "* TODO %?\n  %i\n  %a" "~/.org/TODO.org" "Tasks")                          ("Journal" 106 "* %U %?\n\n  %i\n  %a" "~/.org/JOURNAL.org")                          ("Idea" 105 "* %^{Title}\n  %i\n  %a" "~/.org/JOURNAL.org" "New Ideas")                          ("Molikpaq" 109 "* TODO %?\n  %i\n  %a" "~/.org/Molikpaq.org" "Tasks")                          ("MhaPuja" 112 "* TODO %?\n  %i\n  %a" "~/.org/mha-puja.org" "Tasks")) org-footnote-define-inline t org-export-latex-final-hook '(org-beamer-amend-header org-beamer-fix-toc                               org-beamer-auto-fragile-frames                               org-beamer-place-default-actions-for-lists) org-metadown-hook '(org-babel-pop-to-session-maybe) org-export-blocks '((src org-babel-exp-src-block nil)                     (comment org-export-blocks-format-comment t)                     (ditaa org-export-blocks-format-ditaa nil)                     (dot org-export-blocks-format-dot nil)) )
 		 	   		  

[-- Attachment #1.2: Type: text/html, Size: 24952 bytes --]

[-- Attachment #2: Latex-export-output.pdf --]
[-- Type: application/pdf, Size: 17717 bytes --]

[-- Attachment #3: Latex-export-problems.org --]
[-- Type: application/octet-stream, Size: 2851 bytes --]

#+OPTIONS:     ^:{}



---------------------------------------------------

- Test 1a (works):

: str1\__str2

- Test 1b (works):

#+BEGIN_EXAMPLE
str1\__str2
#+END_EXAMPLE

- Test 1c (does not work):

\verb+str1\__str2+

- Test 1d (does not work):

#+BEGIN_LaTeX
str1\__str2
#+END_LaTeX

- Test 1e (does not work):

\begin{verbatim}
str1\__str2
\end{verbatim}

------------------------------------------------------

- Test 2a (works):

: str1\\__str2

- Test 2b (works):

#+BEGIN_EXAMPLE
str1\\__str2
#+END_EXAMPLE

- Test 2c (does not work):

\verb+str1\\__str2+

- Test 2d (does not work):

#+BEGIN_LaTeX
str1\\__str2
#+END_LaTeX

- Test 2e (does not work):

\begin{verbatim}
str1\\__str2
\end{verbatim}

------------------------------------------

- Test 3a (works):

: str1\_str2

- Test 3b (works):

#+BEGIN_EXAMPLE
str1\_str2
#+END_EXAMPLE

- Test 3c (works):

\verb+str1\_str2+

- Test 3d (does not work):

#+BEGIN_LaTeX
str1\_str2
#+END_LaTeX

- Test 3e (works):

\begin{verbatim}
str1\_str2
\end{verbatim}

-------------------------------------------------------

- Test 4a (works):

: str1\\_str2

- Test 4b (works):

#+BEGIN_EXAMPLE
str1\\_str2
#+END_EXAMPLE

- Test 4c (works):

\verb+str1\\_str2+

- Test 4d (does not work):

#+BEGIN_LaTeX
str1\\_str2
#+END_LaTeX

- Test 4e (works):

\begin{verbatim}
str1\\_str2
\end{verbatim}

------------------------------------------

- Test 5a (works):

: str1\str2

- Test 5b (works):

#+BEGIN_EXAMPLE
str1\str2
#+END_EXAMPLE

- Test 5c (works):

\verb+str1\str2+

- Test 5d (does not work):

#+BEGIN_LaTeX
str1\str2
#+END_LaTeX

- Test 5e (works):

\begin{verbatim}
str1\str2
\end{verbatim}

------------------------------------------

- Test 6a (works):

: str1\\str2

- Test 6b (works):

#+BEGIN_EXAMPLE
str1\\str2
#+END_EXAMPLE

- Test 6c (works):

\verb+str1\\str2+

- Test 6d (does not work):

#+BEGIN_LaTeX
str1\\str2
#+END_LaTeX

- Test 6e (works):

\begin{verbatim}
str1\\str2
\end{verbatim}

------------------------------------------

- Test 7a (works):

: str1_str2

- Test 7b (works):

#+BEGIN_EXAMPLE
str1_str2
#+END_EXAMPLE

- Test 7c (does not work):

\verb+str1_str2+

- Test 7d (does not work):

#+BEGIN_LaTeX
str1_str2
#+END_LaTeX

- Test 7e (works):

\begin{verbatim}
str1_str2
\end{verbatim}

------------------------------------------

- Test 8a (works):

: str1__str2

- Test 8b (works):

#+BEGIN_EXAMPLE
str1__str2
#+END_EXAMPLE

- Test 8c (works):

\verb+str1__str2+

- Test 8d (does not work):

#+BEGIN_LaTeX
str1__str2
#+END_LaTeX

- Test 8e (works):

\begin{verbatim}
str1__str2
\end{verbatim}

------------------------------------------

[-- Attachment #4: Latex-export-problems.tex --]
[-- Type: application/octet-stream, Size: 4461 bytes --]

% Created 2011-05-11 Wed 18:40
\documentclass[11pt]{article}
\usepackage[latin1]{inputenc}
\usepackage[T1]{fontenc}
\usepackage{fixltx2e}
\usepackage{graphicx}
\usepackage{longtable}
\usepackage{float}
\usepackage{wrapfig}
\usepackage{soul}
\usepackage{textcomp}
\usepackage{marvosym}
\usepackage{wasysym}
\usepackage{latexsym}
\usepackage{amssymb}
\usepackage{hyperref}
\tolerance=1000
\providecommand{\alert}[1]{\textbf{#1}}

\title{---------------------------------------------------}
\author{}
\date{11 May 2011}

\begin{document}

\maketitle

\setcounter{tocdepth}{3}
\tableofcontents
\vspace*{1cm}





\begin{itemize}
\item Test 1a (works):
\end{itemize}

\begin{verbatim}
 str1\__str2
\end{verbatim}



\begin{itemize}
\item Test 1b (works):

\begin{verbatim}
str1\__str2
\end{verbatim}
\item Test 1c (does not work):
\end{itemize}

\verb+str1\hspace{3ex}str2+

\begin{itemize}
\item Test 1d (does not work):
\end{itemize}

str1\hspace{3ex}str2


\begin{itemize}
\item Test 1e (does not work):
\end{itemize}

\begin{verbatim}
str1\hspace{3ex}str2
\end{verbatim}

\hrule


\begin{itemize}
\item Test 2a (works):
\end{itemize}

\begin{verbatim}
 str1\\__str2
\end{verbatim}



\begin{itemize}
\item Test 2b (works):

\begin{verbatim}
str1\\__str2
\end{verbatim}
\item Test 2c (does not work):
\end{itemize}

\verb+str1\\hspace{3ex}str2+

\begin{itemize}
\item Test 2d (does not work):
\end{itemize}

str1\\hspace{3ex}str2


\begin{itemize}
\item Test 2e (does not work):
\end{itemize}

\begin{verbatim}
str1\\hspace{3ex}str2
\end{verbatim}

\hrule


\begin{itemize}
\item Test 3a (works):
\end{itemize}

\begin{verbatim}
 str1\_str2
\end{verbatim}



\begin{itemize}
\item Test 3b (works):

\begin{verbatim}
str1\_str2
\end{verbatim}
\item Test 3c (works):
\end{itemize}

\verb+str1\_str2+

\begin{itemize}
\item Test 3d (does not work):
\end{itemize}

str1\_str2


\begin{itemize}
\item Test 3e (works):
\end{itemize}

\begin{verbatim}
str1\_str2
\end{verbatim}

\hrule


\begin{itemize}
\item Test 4a (works):
\end{itemize}

\begin{verbatim}
 str1\\_str2
\end{verbatim}



\begin{itemize}
\item Test 4b (works):

\begin{verbatim}
str1\\_str2
\end{verbatim}
\item Test 4c (works):
\end{itemize}

\verb+str1\\_str2+

\begin{itemize}
\item Test 4d (does not work):
\end{itemize}

str1\\_str2


\begin{itemize}
\item Test 4e (works):
\end{itemize}

\begin{verbatim}
str1\\_str2
\end{verbatim}

\hrule


\begin{itemize}
\item Test 5a (works):
\end{itemize}

\begin{verbatim}
 str1\str2
\end{verbatim}



\begin{itemize}
\item Test 5b (works):

\begin{verbatim}
str1\str2
\end{verbatim}
\item Test 5c (works):
\end{itemize}

\verb+str1\str2+

\begin{itemize}
\item Test 5d (does not work):
\end{itemize}

str1\str2


\begin{itemize}
\item Test 5e (works):
\end{itemize}

\begin{verbatim}
str1\str2
\end{verbatim}

\hrule


\begin{itemize}
\item Test 6a (works):
\end{itemize}

\begin{verbatim}
 str1\\str2
\end{verbatim}



\begin{itemize}
\item Test 6b (works):

\begin{verbatim}
str1\\str2
\end{verbatim}
\item Test 6c (works):
\end{itemize}

\verb+str1\\str2+

\begin{itemize}
\item Test 6d (does not work):
\end{itemize}

str1\\str2


\begin{itemize}
\item Test 6e (works):
\end{itemize}

\begin{verbatim}
str1\\str2
\end{verbatim}

\hrule


\begin{itemize}
\item Test 7a (works):
\end{itemize}

\begin{verbatim}
 str1_str2
\end{verbatim}



\begin{itemize}
\item Test 7b (works):

\begin{verbatim}
str1_str2
\end{verbatim}
\item Test 7c (does not work):
\end{itemize}

\verb+str1\_{}str2+

\begin{itemize}
\item Test 7d (does not work):
\end{itemize}

str1_str2


\begin{itemize}
\item Test 7e (works):
\end{itemize}

\begin{verbatim}
str1_str2
\end{verbatim}

\hrule


\begin{itemize}
\item Test 8a (works):
\end{itemize}

\begin{verbatim}
 str1__str2
\end{verbatim}



\begin{itemize}
\item Test 8b (works):

\begin{verbatim}
str1__str2
\end{verbatim}
\item Test 8c (works):
\end{itemize}

\verb+str1__str2+

\begin{itemize}
\item Test 8d (does not work):
\end{itemize}

str1__str2


\begin{itemize}
\item Test 8e (works):
\end{itemize}

\begin{verbatim}
str1__str2
\end{verbatim}

\hrule

\end{document}

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2011-05-12  2:29 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-05-12  2:09 Bug: Latex export of literal string containing "\__" produces unexpected output [7.5] sharad shrestha

Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).