public inbox archive for pandoc-discuss@googlegroups.com
 help / color / mirror / Atom feed
* Font change in \mbox in LaTeX math mode
@ 2020-09-08 19:57 M A
       [not found] ` <7262e88e-6096-48f2-a7c4-541fa3a15410n-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org>
  0 siblings, 1 reply; 3+ messages in thread
From: M A @ 2020-09-08 19:57 UTC (permalink / raw)
  To: pandoc-discuss


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

I'm converting from LaTeX to MS Word (.docx).  LaTeX lets you embed the 
command

\mbox{...}

in LaTeX math mode.  What goes inside the mbox is normal, non-math-mode 
text and commands.  In my case, I have some special terms that I use 
outside of mathmode, which are italicized, e.g. like

\textit{foo}

I need to embed exactly the same text, formatted in the same way, in math 
mode.  For example, in LaTeX, this is fine:

$2 \times \mbox{\textit{foo}}$

However, when using pandoc to convert to Word, I get this error:

[WARNING] Could not convert TeX math '2\times\mbox{\textit{foo}}', 
rendering as TeX:
  2\times\mbox{\textit{foo}}
               ^
  unexpected "\\"
  expecting "}", text, "{", "$", "$$", "\\(" or "\\["

It appears that \mbox is not treated as an escape out to normal non-math 
mode, so that things that you could normally do in LaTeX in math mode are 
not understood by pandoc.

Is this correct?  Is this just an unimplemented feature?  I know that 
pandoc can 't do everything that LaTeX does; that's OK.  Is there a 
workaround?

Thanks

-- 
You received this message because you are subscribed to the Google Groups "pandoc-discuss" group.
To unsubscribe from this group and stop receiving emails from it, send an email to pandoc-discuss+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org
To view this discussion on the web visit https://groups.google.com/d/msgid/pandoc-discuss/7262e88e-6096-48f2-a7c4-541fa3a15410n%40googlegroups.com.

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

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: Font change in \mbox in LaTeX math mode
       [not found] ` <7262e88e-6096-48f2-a7c4-541fa3a15410n-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org>
@ 2020-09-08 21:02   ` John MacFarlane
       [not found]     ` <m2zh60rnht.fsf-jF64zX8BO08an7k8zZ43ob9bIa4KchGshsV+eolpW18@public.gmane.org>
  0 siblings, 1 reply; 3+ messages in thread
From: John MacFarlane @ 2020-09-08 21:02 UTC (permalink / raw)
  To: M A, pandoc-discuss


Math conversion is handled by the texmath library.  This is
specialized to math, and in the particular case you're interested
converts tex math to the math format used by Word.

Since it's specialized to math, it doesn't know how to handle
arbitrary non-math text of the sort that can go into an mbox.

There's not a good solution without changes in texmath's
architecture (one can imagine changing it so you pass in a parser
for normal text in the target format, which would be used inside
mboxes).

I wouldn't hold your breath, but you could put up an issue
on jgm/texmath on GitHub so we don't lose track.

M A <marshall-g+3rYsS+t1LR7s880joybQ@public.gmane.org> writes:

> I'm converting from LaTeX to MS Word (.docx).  LaTeX lets you embed the 
> command
>
> \mbox{...}
>
> in LaTeX math mode.  What goes inside the mbox is normal, non-math-mode 
> text and commands.  In my case, I have some special terms that I use 
> outside of mathmode, which are italicized, e.g. like
>
> \textit{foo}
>
> I need to embed exactly the same text, formatted in the same way, in math 
> mode.  For example, in LaTeX, this is fine:
>
> $2 \times \mbox{\textit{foo}}$
>
> However, when using pandoc to convert to Word, I get this error:
>
> [WARNING] Could not convert TeX math '2\times\mbox{\textit{foo}}', 
> rendering as TeX:
>   2\times\mbox{\textit{foo}}
>                ^
>   unexpected "\\"
>   expecting "}", text, "{", "$", "$$", "\\(" or "\\["
>
> It appears that \mbox is not treated as an escape out to normal non-math 
> mode, so that things that you could normally do in LaTeX in math mode are 
> not understood by pandoc.
>
> Is this correct?  Is this just an unimplemented feature?  I know that 
> pandoc can 't do everything that LaTeX does; that's OK.  Is there a 
> workaround?
>
> Thanks
>
> -- 
> You received this message because you are subscribed to the Google Groups "pandoc-discuss" group.
> To unsubscribe from this group and stop receiving emails from it, send an email to pandoc-discuss+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org
> To view this discussion on the web visit https://groups.google.com/d/msgid/pandoc-discuss/7262e88e-6096-48f2-a7c4-541fa3a15410n%40googlegroups.com.


^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: Font change in \mbox in LaTeX math mode
       [not found]     ` <m2zh60rnht.fsf-jF64zX8BO08an7k8zZ43ob9bIa4KchGshsV+eolpW18@public.gmane.org>
@ 2020-09-09  3:57       ` M A
  0 siblings, 0 replies; 3+ messages in thread
From: M A @ 2020-09-09  3:57 UTC (permalink / raw)
  To: pandoc-discuss


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

Ah, OK.  I understand.  Thanks John.  

I found a workaround for my LaTeX code, but I'm happy to know what was 
happening, and what to look out for in the future.

On Tuesday, September 8, 2020 at 4:02:25 PM UTC-5 John MacFarlane wrote:

>
> Math conversion is handled by the texmath library. This is 
> specialized to math, and in the particular case you're interested 
> converts tex math to the math format used by Word. 
>
> Since it's specialized to math, it doesn't know how to handle 
> arbitrary non-math text of the sort that can go into an mbox. 
>
> There's not a good solution without changes in texmath's 
> architecture (one can imagine changing it so you pass in a parser 
> for normal text in the target format, which would be used inside 
> mboxes). 
>
> I wouldn't hold your breath, but you could put up an issue 
> on jgm/texmath on GitHub so we don't lose track. 
>
> M A writes: 
>
> > I'm converting from LaTeX to MS Word (.docx). LaTeX lets you embed the 
> > command 
> > 
> > \mbox{...} 
> > 
> > in LaTeX math mode. What goes inside the mbox is normal, non-math-mode 
> > text and commands. In my case, I have some special terms that I use 
> > outside of mathmode, which are italicized, e.g. like 
> > 
> > \textit{foo} 
> > 
> > I need to embed exactly the same text, formatted in the same way, in 
> math 
> > mode. For example, in LaTeX, this is fine: 
> > 
> > $2 \times \mbox{\textit{foo}}$ 
> > 
> > However, when using pandoc to convert to Word, I get this error: 
> > 
> > [WARNING] Could not convert TeX math '2\times\mbox{\textit{foo}}', 
> > rendering as TeX: 
> > 2\times\mbox{\textit{foo}} 
> > ^ 
> > unexpected "\\" 
> > expecting "}", text, "{", "$", "$$", "\\(" or "\\[" 
> > 
> > It appears that \mbox is not treated as an escape out to normal non-math 
> > mode, so that things that you could normally do in LaTeX in math mode 
> are 
> > not understood by pandoc. 
> > 
> > Is this correct? Is this just an unimplemented feature? I know that 
> > pandoc can 't do everything that LaTeX does; that's OK. Is there a 
> > workaround? 
> > 
> > Thanks 
> > 
> > -- 
> > You received this message because you are subscribed to the Google 
> Groups "pandoc-discuss" group. 
> > To unsubscribe from this group and stop receiving emails from it, send 
> an email to pandoc-discus...-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org 
> > To view this discussion on the web visit 
> https://groups.google.com/d/msgid/pandoc-discuss/7262e88e-6096-48f2-a7c4-541fa3a15410n%40googlegroups.com. 
>
>

-- 
You received this message because you are subscribed to the Google Groups "pandoc-discuss" group.
To unsubscribe from this group and stop receiving emails from it, send an email to pandoc-discuss+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org
To view this discussion on the web visit https://groups.google.com/d/msgid/pandoc-discuss/76286a6c-b8d6-4098-b1c2-5d9e28309ec8n%40googlegroups.com.

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

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2020-09-09  3:57 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-09-08 19:57 Font change in \mbox in LaTeX math mode M A
     [not found] ` <7262e88e-6096-48f2-a7c4-541fa3a15410n-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org>
2020-09-08 21:02   ` John MacFarlane
     [not found]     ` <m2zh60rnht.fsf-jF64zX8BO08an7k8zZ43ob9bIa4KchGshsV+eolpW18@public.gmane.org>
2020-09-09  3:57       ` M A

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 NNTP newsgroup(s).