How to channel an otexstream into a variable?

Kornel Benko kornel at lyx.org
Sun Aug 28 11:56:26 UTC 2022


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.

	Kornel
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 488 bytes
Desc: Digitale Signatur von OpenPGP
URL: <http://lists.lyx.org/pipermail/lyx-devel/attachments/20220828/6e8d5edf/attachment-0001.asc>


More information about the lyx-devel mailing list