multi paragraph inside a command

2022-12-31 Thread tush via lyx-users
I created a style in my local layout that has "LatexType Command".
Is it possible to allow the user to insert multiple lines of text inside this 
command?
Something like the option MultiPar 1 (which is good only for InsetLayout Flex, 
not for Style.)

What I want is to get the following Latex code:

\mycommand{Lorem ipsum
〈¶〉
dolor
〈¶〉
sit amet}-- 
lyx-users mailing list
lyx-users@lists.lyx.org
http://lists.lyx.org/mailman/listinfo/lyx-users


Re: multi paragraph inside a command

2022-12-31 Thread Udicoudco
On Sat, Dec 31, 2022 at 10:32 PM tush via lyx-users 
wrote:

> I created a style in my local layout that has "LatexTypeCommand".
> Is it possible to allow the user to insert multiple lines of text inside
> this command?
> Something like the option MultiPar   1 (which is good only for InsetLayout
> Flex, not for Style.)
>
> What I want is to get the following Latex code:
>
> \mycommand{Lorem ipsum
> 〈¶〉
> dolor
> 〈¶〉
> sit amet}
>
>
Hello ehud,

I don't know if it can be done in lyx, but i can suggest a workaround for
that (of course it is only
valid if your command is long in the first place).

You can set your style to be of "Latex TypeEnvironment" and create an
environment
that passes its body to \mycommand.

To do that, add to your style definition the following:

LatexNamemyenv
Preamble
\newcommand\mycommand[1]{}
\usepackage{environ}
\NewEnviron{myenv}{\mycommand{\BODY}}
EndPreamble

Note that with some commands it wont work due expansion order of \BODY,
so you might need to write

LatexNamemyenv
Preamble
\newcommand\mycommand[1]{}
\usepackage{environ}
\NewEnviron{myenv}{\expandafter\mycommand\expandafter{\BODY}}
EndPreamble

instead.

Hope it helps,
Udi

> lyx-users mailing list
> lyx-users@lists.lyx.org
> http://lists.lyx.org/mailman/listinfo/lyx-users
>
-- 
lyx-users mailing list
lyx-users@lists.lyx.org
http://lists.lyx.org/mailman/listinfo/lyx-users


Re: multi paragraph inside a command

2023-01-01 Thread Steve Litt
tush via lyx-users said on Sat, 31 Dec 2022 20:32:12 +

>I created a style in my local layout that has "LatexType Command".
>Is it possible to allow the user to insert multiple lines of text
>inside this command? Something like the option MultiPar 1 (which is
>good only for InsetLayout Flex, not for Style.)
>
>What I want is to get the following Latex code:
>
>\mycommand{Lorem ipsum
>〈¶〉
>dolor
>〈¶〉
>sit amet}

I like Udi's solution a lot better, but you can linefeed with
\\[measurement] .

SteveT

Steve Litt 
Autumn 2022 featured book: Thriving in Tough Times
http://www.troubleshooters.com/bookstore/thrive.htm
-- 
lyx-users mailing list
lyx-users@lists.lyx.org
http://lists.lyx.org/mailman/listinfo/lyx-users


Re: multi paragraph inside a command

2023-01-01 Thread Herbert Voss



Am 01.01.23 um 09:50 schrieb Steve Litt:

tush via lyx-users said on Sat, 31 Dec 2022 20:32:12 +


I created a style in my local layout that has "LatexType Command".
Is it possible to allow the user to insert multiple lines of text
inside this command? Something like the option MultiPar 1 (which is
good only for InsetLayout Flex, not for Style.)

What I want is to get the following Latex code:

\mycommand{Lorem ipsum
〈¶〉
dolor
〈¶〉
sit amet}

I like Udi's solution a lot better, but you can linefeed with
\\[measurement] .



that should be used only in tabulars or arrays, not in the default text 
area.

Use \par, \smallskip, \medskip, \bigskip, or \vspace{...}  instead

Herbert


--
lyx-users mailing list
lyx-users@lists.lyx.org
http://lists.lyx.org/mailman/listinfo/lyx-users