Re: [PATCH] lisp/ox-latex.el: put labels inside example blocks

2022-12-08 Thread Ihor Radchenko
Ihor Radchenko  writes:

>> Please, revert this patch. Default environment for #+begin_example is 
>> verbatim. With this patch the following PDF is generated
>>
>>  \label{org9283054}
>>  code
>>
>> for
>>
>>  #+name: test
>>  #+begin_example
>>code
>>  #+end_example
>>
>> It is the reason why \label must be outside. I do not remember if line 
>> break penalty helps after \label.
>
> Oops. You are indeed right.
> Reverted.

Hugo, you may consider writing an alternative patch that only puts label
inside for the environments where we know that it is safe.

-- 
Ihor Radchenko // yantar92,
Org mode contributor,
Learn more about Org mode at .
Support Org development at ,
or support my work at 



Re: [PATCH] lisp/ox-latex.el: put labels inside example blocks

2022-12-08 Thread Ihor Radchenko
Max Nikulin  writes:

>> Applied onto bugfix.
>> https://git.savannah.gnu.org/cgit/emacs/org-mode.git/commit/?id=304f18cb7
>
> Please, revert this patch. Default environment for #+begin_example is 
> verbatim. With this patch the following PDF is generated
>
>  \label{org9283054}
>  code
>
> for
>
>  #+name: test
>  #+begin_example
>code
>  #+end_example
>
> It is the reason why \label must be outside. I do not remember if line 
> break penalty helps after \label.

Oops. You are indeed right.
Reverted.

-- 
Ihor Radchenko // yantar92,
Org mode contributor,
Learn more about Org mode at .
Support Org development at ,
or support my work at 



Re: [PATCH] lisp/ox-latex.el: put labels inside example blocks

2022-12-08 Thread Max Nikulin

On 08/12/2022 18:39, Ihor Radchenko wrote:

h...@heagren.com writes:

The attached patch forces example environments to be printed thus:

,---
|  \begin{example}\label{ex:foo}
| My example here
|  \end{example}
`---


Applied onto bugfix.
https://git.savannah.gnu.org/cgit/emacs/org-mode.git/commit/?id=304f18cb7


Please, revert this patch. Default environment for #+begin_example is 
verbatim. With this patch the following PDF is generated


\label{org9283054}
code

for

#+name: test
#+begin_example
  code
#+end_example

It is the reason why \label must be outside. I do not remember if line 
break penalty helps after \label.




Re: [PATCH] lisp/ox-latex.el: put labels inside example blocks

2022-12-08 Thread Ihor Radchenko
h...@heagren.com writes:

> The attached patch forces example environments to be printed thus:
>
> ,---
> |  \begin{example}\label{ex:foo}
> | My example here
> |  \end{example}
> `---
>
> This solves the problem.
>
> The logic/conditions for when to print a label, and how it is generated
> remain unchanged.
>
> Hope this is helpful for someone else too!

Thanks!
Applied onto bugfix.
https://git.savannah.gnu.org/cgit/emacs/org-mode.git/commit/?id=304f18cb7

-- 
Ihor Radchenko // yantar92,
Org mode contributor,
Learn more about Org mode at .
Support Org development at ,
or support my work at