Re: Using .[ and .] in a macro
Le 2023-12-03 à 07:47, hbezemer--- via a écrit : Dear all,I would like to create a macro along the lines of:.de CITE.[\\$2\\$1.]\\$3..Which would result in:.CITE The problem that arises is that refer sees the definition of the macro asa citation (of course).Is there an elegant way to get this to work?Kind regards,Hans Hi, It sounds like you should not be able to do what you want since refer process the file before groff and thus your .CITE macro will not be defined when the file goes through refer. Regards, -- Thomas
Using .[ and .] in a macro
Dear all,I would like to create a macro along the lines of:.de CITE.[\\$2\\$1.]\\$3..Which would result in:.CITE The problem that arises is that refer sees the definition of the macro asa citation (of course).Is there an elegant way to get this to work?Kind regards,Hans
Re: using .so in a macro
Thank you all for the information. On Thu, Feb 16, 2023 at 9:41 PM Oliver Marti wrote: > > Hy Riza > > Soelim is just like cat but it "eliminates" the .so, which can cause utf-8 > malfunctions (it basically puts the whole file together as one without > ignoring e.g. preconv or other piping functions). > > I think you can just use soelim main.ms | ... | groff -ms -Tps > output.ps. > cat seems to be redundant here. > > Or even put pic and tbl directly to the groff line (soelim main.ms | groff > -ms -pic -tb -Tps > output). > > Greetings, > Oliver > (non-expert) > > > > Riza Dindir schrieb am Do., 16. Feb. 2023, 15:31: >> >> Hello Ralph, >> >> I was using soelim in my pipeline (cat main.ms | soelim | pic | tbl | >> groff -ms > main.ps). The problem was with soelim. I did not realize >> that. I first had it with double slashes, but then tried with four >> slashes... Removing soelim from the pipeline resolved the problem. >> >> What is soelim used for? Since troff has the .so command, it must be >> used for a special purpose. >> >> Thanks. >> >> On Thu, Feb 16, 2023 at 1:05 PM Ralph Corderoy wrote: >> > >> > Hello Riza, >> > >> > > Is it possible to use the ".so" command in a macro, and pass in an >> > > argument from the macro. >> > > >> > > .de MC >> > > .so $1 >> > > .. >> > > >> > > .MC file.txt >> > >> > Yes. >> > >> > $ cat >foo >> > .de source >> > .so \\$1 >> > .. >> > foo >> > .source bar >> > foo >> > ^D >> > $ >> > $ cat >bar >> > bar >> > ^D >> > $ >> > $ nroff foo | grep . >> > foo bar foo >> > $ >> > >> > You're escaping the ‘$’ too much. You're seeing: >> > >> > $ nroff foo | grep . >> > troff: foo:5: can't open '\$1': No such file or directory >> > foo foo >> > $ >> > >> > -- >> > Cheers, Ralph. >>
Re: using .so in a macro
Hy Riza Soelim is just like cat but it "eliminates" the .so, which can cause utf-8 malfunctions (it basically puts the whole file together as one without ignoring e.g. preconv or other piping functions). I think you can just use soelim main.ms | ... | groff -ms -Tps > output.ps. cat seems to be redundant here. Or even put pic and tbl directly to the groff line (soelim main.ms | groff -ms -pic -tb -Tps > output). Greetings, Oliver (non-expert) Riza Dindir schrieb am Do., 16. Feb. 2023, 15:31: > Hello Ralph, > > I was using soelim in my pipeline (cat main.ms | soelim | pic | tbl | > groff -ms > main.ps). The problem was with soelim. I did not realize > that. I first had it with double slashes, but then tried with four > slashes... Removing soelim from the pipeline resolved the problem. > > What is soelim used for? Since troff has the .so command, it must be > used for a special purpose. > > Thanks. > > On Thu, Feb 16, 2023 at 1:05 PM Ralph Corderoy > wrote: > > > > Hello Riza, > > > > > Is it possible to use the ".so" command in a macro, and pass in an > > > argument from the macro. > > > > > > .de MC > > > .so $1 > > > .. > > > > > > .MC file.txt > > > > Yes. > > > > $ cat >foo > > .de source > > .so \\$1 > > .. > > foo > > .source bar > > foo > > ^D > > $ > > $ cat >bar > > bar > > ^D > > $ > > $ nroff foo | grep . > > foo bar foo > > $ > > > > You're escaping the ‘$’ too much. You're seeing: > > > > $ nroff foo | grep . > > troff: foo:5: can't open '\$1': No such file or directory > > foo foo > > $ > > > > -- > > Cheers, Ralph. > >
Re: using .so in a macro
Hello Riza, > Hello Ralph, > > cat main.ms | soelim | pic | tbl | groff -ms > main.ps ... > What is soelim used for? soelim(1) attempts to explain. It doesn't tend to be needed when one starts using troff but might be wanted in special cases later. Consider the difference between these two if foo does a .so of bar. pic foo | troff soleim foo | pic | troff Given the .so is processed by troff at the end of the pipeline, the first leaves bar unseen by pic whereas the second includes bar's content in the standard input seen by pic. -- Cheers, Ralph.
Re: using .so in a macro
Hello Ralph, I was using soelim in my pipeline (cat main.ms | soelim | pic | tbl | groff -ms > main.ps). The problem was with soelim. I did not realize that. I first had it with double slashes, but then tried with four slashes... Removing soelim from the pipeline resolved the problem. What is soelim used for? Since troff has the .so command, it must be used for a special purpose. Thanks. On Thu, Feb 16, 2023 at 1:05 PM Ralph Corderoy wrote: > > Hello Riza, > > > Is it possible to use the ".so" command in a macro, and pass in an > > argument from the macro. > > > > .de MC > > .so $1 > > .. > > > > .MC file.txt > > Yes. > > $ cat >foo > .de source > .so \\$1 > .. > foo > .source bar > foo > ^D > $ > $ cat >bar > bar > ^D > $ > $ nroff foo | grep . > foo bar foo > $ > > You're escaping the ‘$’ too much. You're seeing: > > $ nroff foo | grep . > troff: foo:5: can't open '\$1': No such file or directory > foo foo > $ > > -- > Cheers, Ralph.
Re: using .so in a macro
Hello Riza, > Is it possible to use the ".so" command in a macro, and pass in an > argument from the macro. > > .de MC > .so $1 > .. > > .MC file.txt Yes. $ cat >foo .de source .so \\$1 .. foo .source bar foo ^D $ $ cat >bar bar ^D $ $ nroff foo | grep . foo bar foo $ You're escaping the ‘$’ too much. You're seeing: $ nroff foo | grep . troff: foo:5: can't open '\$1': No such file or directory foo foo $ -- Cheers, Ralph.
using .so in a macro
Hello, Is it possible to use the ".so" command in a macro, and pass in an argument from the macro. .de MC .so $1 .. .MC file.txt