How to channel an otexstream into a variable?

Scott Kostyshak skostysh at lyx.org
Sun Aug 28 12:56:17 UTC 2022


On Sun, Aug 28, 2022 at 01:56:26PM +0200, Kornel Benko wrote:
> Am Fri, 26 Aug 2022 22:24:46 -0400
> schrieb Scott Kostyshak <skostysh at lyx.org>:
> 
> > Suppose I want to do something like store the LaTeX produced by TeXOnePar() into a
> > variable. How can I do that? From what I understand, TeXOnePar() write to the 'os'
> > argument, which I imagine is connected to a file (?), so there is no way to retrieve
> > the TeX from 'os'.
> > 
> > Is that right? If so, is there a way to create an otexstream that writes to a variable.
> > i.e., can I do something like the following?
> > 
> >   TexString sktex;
> >   otexstream os2(sktex);
> >   TeXOnePar(..., os2, ...);
> > 
> > And then the variable 'sktex' would contain the LaTeX that TeXOnePar() produced?
> > 
> > Thanks,
> > Scott
> 
> You may like to look how lyxfind.cpp calls TeXOnePar() in
> 	static docstring buffer_to_latex(Buffer & buffer)
> 
> Of course, the settings for 'find' are not what you need.

That is exactly what I was looking for!

Thank you,

Scott
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 488 bytes
Desc: not available
URL: <http://lists.lyx.org/pipermail/lyx-devel/attachments/20220828/7139394a/attachment.asc>


More information about the lyx-devel mailing list