Greetings. I like to embed pseudocode etc. in example blocks so that it is typeset in monospace when exported. But sometimes I would need special symbols, such as \neq, in pseudocode. What is the easiest way to combine monospace and special symbols? Jarmo

```
Jarmo Hurri wrote:
>
> I like to embed pseudocode etc. in example blocks so that it is typeset
> in monospace when exported. But sometimes I would need special symbols,
> such as \neq, in pseudocode. What is the easiest way to combine
> monospace and special symbols?
Is there any problem with UTF-8 symbols such as "≠"? I have typed it using
Compose / =
```

```
On Thursday, 15 Oct 2020 at 09:13, Jarmo Hurri wrote:
> I like to embed pseudocode etc. in example blocks so that it is typeset
> in monospace when exported. But sometimes I would need special symbols,
> such as \neq, in pseudocode. What is the easiest way to combine
> monospace and special symbols?
I resort to LaTeX for this, using a LaTeX src block with the algorithm
and algpseudocode packages.
--
: Eric S Fraga via Emacs 28.0.50, Org release_9.4-57-g8402c4
```

>>>>> Jarmo Hurri <jarmo.hurri@iki.fi> writes: > Greetings. > I like to embed pseudocode etc. in example blocks so that it is > typeset in monospace when exported. But sometimes I would need > special symbols, such as \neq, in pseudocode. What is the easiest > way to combine monospace and special symbols? > Jarmo Would https://github.com/jsalzbergedu/pseudocode-mode be any good? Best wishes, Colin Baxter URL: http://www.Colin-Baxter.com --------------------------------------------------------------------- GnuPG fingerprint: 68A8 799C 0230 16E7 BF68 2A27 BBFA 2492 91F5 41C8 ---------------------------------------------------------------------

```
Hi there!
Colin Baxter <m43cap@yandex.com> writes:
> Would https://github.com/jsalzbergedu/pseudocode-mode be any good?
I will have to explore it. The documentation is almost as thin as my
wallet.
Thanks,
Jarmo
```

```
Hi there.
Eric S Fraga <e.fraga@ucl.ac.uk> writes:
> I resort to LaTeX for this, using a LaTeX src block with the algorithm
> and algpseudocode packages.
In my case there is a specific pseudocode format I need to use. I think
I would have to try to tune one of these packages pretty heavily.
But I will see. Thanks.
Jarmo
```

```
Hello.
Maxim Nikulin <manikulin@gmail.com> writes:
> Jarmo Hurri wrote:
>> What is the easiest way to combine monospace and special symbols?
>
> Is there any problem with UTF-8 symbols such as "≠"? I have typed it using
> Compose / =
At least out of the box, the UTF-8 symbol is not exported.
All the best,
Jarmo
```

```
On Thursday, 15 Oct 2020 at 12:31, Jarmo Hurri wrote:
> In my case there is a specific pseudocode format I need to use. I think
> I would have to try to tune one of these packages pretty heavily.
In that case, you may simply wish to use the alltt environment. This
works for me:
#+begin_src org
,* algorithm pseudo code
,#+latex_header: \usepackage{alltt}
,#+begin_alltt
for i \in [0,1] do
if i \neq 3
x ← i^2
end if
end for
,#+end_alltt
#+end_src
HTH,
eric
--
: Eric S Fraga via Emacs 28.0.50, Org release_9.4-57-g8402c4
```

```
Jarmo Hurri wrote:
> Maxim Nikulin writes:
>
>> Jarmo Hurri wrote:
>>> What is the easiest way to combine monospace and special symbols?
>>
>> Is there any problem with UTF-8 symbols such as "≠"? I have typed it using
>> Compose / =
>
> At least out of the box, the UTF-8 symbol is not exported.
#+BEGIN_SRC emacs-lisp
(add-to-list 'org-latex-inputenc-alist '("utf8" . "utf8x"))
#+END_SR
```

```
Maxim Nikulin <manikulin@gmail.com> writes:
>>>> What is the easiest way to combine monospace and special symbols?
>>>
>>> Is there any problem with UTF-8 symbols such as "≠"? I have typed it using
>>> Compose / =
>>
>> At least out of the box, the UTF-8 symbol is not exported.
>
> #+BEGIN_SRC emacs-lisp
> (add-to-list 'org-latex-inputenc-alist '("utf8" . "utf8x"))
> #+END_SR
Noice!
Thanks,
Jarmo
```

```
Eric S Fraga <e.fraga@ucl.ac.uk> writes:
> In that case, you may simply wish to use the alltt environment. This
> works for me:
>
> #+begin_src org
> ,* algorithm pseudo code
> ,#+latex_header: \usepackage{alltt}
> ,#+begin_alltt
> for i \in [0,1] do
> if i \neq 3
> x ← i^2
> end if
> end for
> ,#+end_alltt
> #+end_src
Excellent, works for me too.
What a great community!
Jarmo
```

```
Hello Eric,
>>>>> Eric S Fraga <e.fraga@ucl.ac.uk> writes:
> On Thursday, 15 Oct 2020 at 12:31, Jarmo Hurri wrote:
>> In my case there is a specific pseudocode format I need to use. I
>> think I would have to try to tune one of these packages pretty
>> heavily.
> In that case, you may simply wish to use the alltt environment.
> This works for me:
> #+begin_src org ,* algorithm pseudo code ,#+latex_header:
> \usepackage{alltt} ,#+begin_alltt for i \in [0,1] do if i \neq 3 x
> ← i^2 end if end for ,#+end_alltt #+end_src
Is there any reason why you don't use LaTeX's \leftarrow in place of ← ?
With perhaps a (set-input-method 'TeX).
Best wishes,
```

```
On Thursday, 15 Oct 2020 at 16:03, Colin Baxter wrote:
> Is there any reason why you don't use LaTeX's \leftarrow in place of ← ?
> With perhaps a (set-input-method 'TeX).
Funnily enough, it's because I was originally using the TeX input method
(which I love) that I ended up with ← instead of \gets... :-)
I had realized that my LaTeX did not understand ∈ when I exported to PDF
and so I changed all (but not all) input to LaTeX and not utf-8
symbols. I missed that line!
--
: Eric S Fraga via Emacs 28.0.50, Org release_9.4-57-g8402c4
```