Okay, great, so something like

.. |bs| raw:: latex

         \

.. |braces| raw:: latex

         {}

converts "|bs|\ LaTeX\ |braces|" into "\LaTeX{}" in latex mode, which is 
what I want. Thank you!


On Monday, October 29, 2018 at 5:43:52 AM UTC-7, jfbu wrote:
>
> And to use same source for multiple targets (which is normal expectation), 
>
> .. |bs| raw:: latex 
>
>          \ 
>
> hello |bs|\ LaTeX\ |bs| world 
>
>
> This will produce 
>
> hello \LaTeX\ world 
>
> with latex builder 
>
> and 
>
> hello LaTeX world 
>
> with html and other builders 
>
> best, 
>
> Jean-François 
>
>
> Le 29/10/2018 à 10:21, Matthias Geier a écrit : 
> > Alternatively, you can also define a custom "role", e.g.: 
> > 
> >      .. role:: raw-latex(raw) 
> >         :format: latex 
> > 
> > Then you can use :raw-latex:`arbitrary \LaTeX\ commands` in a normal 
> paragraph. 
> > 
> > See https://stackoverflow.com/q/7533406/. 
> > 
> > cheers, 
> > Matthias 
> > On Sun, Oct 28, 2018 at 11:30 AM jfbu <[email protected] <javascript:>> 
> wrote: 
> >> 
> >> 
> >> Hi, just to point out a slight amendment to Takeshi's advice in this 
> specific case: add a backslash after the LaTeX command name (here \LaTeX). 
> >> 
> >>       .. |latex| raw:: latex 
> >> 
> >>          \LaTeX\ 
> >> 
> >>       hello |latex| world 
> >> 
> >> or in place of \LaTeX\, use\LaTeX{} 
> >> 
> >> This is due to well-known to LaTeX users behaviour of "\command<space>" 
> >> 
> >> (rest mark-up use \<space> to suppress a space, LaTeX mark-up uses 
> \<space> to force a space... in the substitution the contents is taken over 
> literally and handed over as is to the produced LaTeX file, so we must 
> obide therein by the rules of LaTeX mark-up) 
> >> 
> >> Jean-François 
> >> 
> >> Le 27/10/2018 à 10:42, Komiya Takeshi a écrit : 
> >>> You can do it with raw directive and substitution:: 
> >>> 
> >>>       .. |latex| raw:: latex 
> >>> 
> >>>          \LaTeX 
> >>> 
> >>>       hello |latex| world 
> >>> 
> >>> But the LaTeX is only shown on LaTeX output. If you want to see it on 
> >>> other outputs, any extension might be needed. 
> >>> 
> >>> Thanks, 
> >>> Takeshi KOMIYA 
> >>> 2018年10月27日(土) 6:03 John H Palmieri <[email protected] <javascript:>>: 
>
> >>>> 
> >>>> If I use the string "\LaTeX" in an reST document and run it through 
> Sphinx's latex builder, it strips the leading backslash, so if I run it 
> through Sphinx's pdf builder, I just get the text "LaTeX". I would instead 
> like to use the command "\LaTeX", which produces a nicely typeset LateX 
> symbol. Is there any way to do this? 
> >>>> 
> >>>> To be honest, I know one way, but it is hacky: use something like 
> \hbox{\LaTeX} within math mode. But there is the broader question of how to 
> use LaTeX commands which are not supposed to be in math mode. Suggestions? 
> >>>> 
> >>>> 
> >>>> -- 
> >>>> You received this message because you are subscribed to the Google 
> Groups "sphinx-users" group. 
> >>>> To unsubscribe from this group and stop receiving emails from it, 
> send an email to [email protected] <javascript:>. 
> >>>> To post to this group, send email to [email protected] 
> <javascript:>. 
> >>>> Visit this group at https://groups.google.com/group/sphinx-users. 
> >>>> For more options, visit https://groups.google.com/d/optout. 
> >>> 
> >> 
> >> 
> >> -- 
> >> You received this message because you are subscribed to the Google 
> Groups "sphinx-users" group. 
> >> To unsubscribe from this group and stop receiving emails from it, send 
> an email to [email protected] <javascript:>. 
> >> To post to this group, send email to [email protected] 
> <javascript:>. 
> >> Visit this group at https://groups.google.com/group/sphinx-users. 
> >> For more options, visit https://groups.google.com/d/optout. 
> > 
>
>
>

-- 
You received this message because you are subscribed to the Google Groups 
"sphinx-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at https://groups.google.com/group/sphinx-users.
For more options, visit https://groups.google.com/d/optout.

Reply via email to