Rocksolid Light

Welcome to RetroBBS

mail  files  register  newsreader  groups  login

Message-ID:  

* gb notes that fdisk thinks his cdrom can store one terabyte -- Seen on #Linux


computers / comp.text.tex / Function for boilerplate

SubjectAuthor
* Function for boilerplateCecil Westerhof
`* Re: Function for boilerplatePieter van Oostrum
 `* Re: Function for boilerplateCecil Westerhof
  `* Re: Function for boilerplatePieter van Oostrum
   `- Re: Function for boilerplateCecil Westerhof

1
Function for boilerplate

<878rkglapj.fsf@munus.decebal.nl>

  copy mid

https://www.rocksolidbbs.com/computers/article-flat.php?id=5615&group=comp.text.tex#5615

  copy link   Newsgroups: comp.text.tex
Path: i2pn2.org!i2pn.org!eternal-september.org!reader01.eternal-september.org!.POSTED!not-for-mail
From: Cecil@decebal.nl (Cecil Westerhof)
Newsgroups: comp.text.tex
Subject: Function for boilerplate
Date: Sat, 12 Nov 2022 11:38:00 +0100
Organization: Decebal Computing
Lines: 18
Message-ID: <878rkglapj.fsf@munus.decebal.nl>
MIME-Version: 1.0
Content-Type: text/plain
Injection-Info: reader01.eternal-september.org; posting-host="1b67cba4932ef5e18ef450eca8aa8021";
logging-data="1224986"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX19MVgyCWJW9JaTvYsQ/yWXc8Sbyh0Qg7Nk="
User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/27.1 (gnu/linux)
Cancel-Lock: sha1:CGsNalLlImZSbd/92szemlJ42OM=
sha1:OJpYUFdb7OB/panx61Faly7ioZY=
 by: Cecil Westerhof - Sat, 12 Nov 2022 10:38 UTC

In a document I have twelve times:
Some text

\begin{figure}[h]
\adjustimage{width = \textwidth}{imageName}
\centering
\end{figure}
\vspace{\baselineskip}

Could I write a function to be called like:
\placeImage{Some text}{imageName}

Would be more clear and easier to maintain.

--
Cecil Westerhof
Senior Software Engineer
LinkedIn: http://www.linkedin.com/in/cecilwesterhof

Re: Function for boilerplate

<m2leognq63.fsf@vanoostrum.org>

  copy mid

https://www.rocksolidbbs.com/computers/article-flat.php?id=5620&group=comp.text.tex#5620

  copy link   Newsgroups: comp.text.tex
Path: i2pn2.org!i2pn.org!aioe.org!news.mb-net.net!open-news-network.org!news.mind.de!bolzen.all.de!fu-berlin.de!uni-berlin.de!individual.net!not-for-mail
From: pieter-l@vanoostrum.org (Pieter van Oostrum)
Newsgroups: comp.text.tex
Subject: Re: Function for boilerplate
Date: Sat, 12 Nov 2022 16:33:24 +0100
Lines: 33
Message-ID: <m2leognq63.fsf@vanoostrum.org>
References: <878rkglapj.fsf@munus.decebal.nl>
Mime-Version: 1.0
Content-Type: text/plain
X-Trace: individual.net Xzn/MYhOhxPGf4yY5u6JRQEuim94NfpdZi9KrTNEmCzGfY8Yyw
Cancel-Lock: sha1:A0Mq4ZI9pffBle1IyrBRpHxR0gw= sha1:CHdaXViEibCQWXS8FSCVpwPBrEk=
User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/28.2 (darwin)
 by: Pieter van Oostrum - Sat, 12 Nov 2022 15:33 UTC

Cecil Westerhof <Cecil@decebal.nl> writes:

> In a document I have twelve times:
> Some text
>
> \begin{figure}[h]
> \adjustimage{width = \textwidth}{imageName}
> \centering
> \end{figure}
> \vspace{\baselineskip}
>
> Could I write a function to be called like:
> \placeImage{Some text}{imageName}
>
> Would be more clear and easier to maintain.
>

That's what macros are for:

\newcommand\placeImage[2]{%
#1

\begin{figure}[h]
\adjustimage{width = \textwidth}{#2}
\centering
\end{figure}
\vspace{\baselineskip}
}

--
Pieter van Oostrum <pieter@vanoostrum.org>
www: http://pieter.vanoostrum.org/
PGP key: [8DAE142BE17999C4]

Re: Function for boilerplate

<87bkpbkfo8.fsf@munus.decebal.nl>

  copy mid

https://www.rocksolidbbs.com/computers/article-flat.php?id=5627&group=comp.text.tex#5627

  copy link   Newsgroups: comp.text.tex
Path: i2pn2.org!i2pn.org!eternal-september.org!reader01.eternal-september.org!.POSTED!not-for-mail
From: Cecil@decebal.nl (Cecil Westerhof)
Newsgroups: comp.text.tex
Subject: Re: Function for boilerplate
Date: Sat, 12 Nov 2022 22:48:23 +0100
Organization: Decebal Computing
Lines: 43
Message-ID: <87bkpbkfo8.fsf@munus.decebal.nl>
References: <878rkglapj.fsf@munus.decebal.nl> <m2leognq63.fsf@vanoostrum.org>
MIME-Version: 1.0
Content-Type: text/plain
Injection-Info: reader01.eternal-september.org; posting-host="1b67cba4932ef5e18ef450eca8aa8021";
logging-data="1324350"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1+L7Dg2of4bLXzinNUPtCN48ranJ9fjDIg="
User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/27.1 (gnu/linux)
Cancel-Lock: sha1:zEek4RRsyhgULq1Wd7SD7jtedGw=
sha1:CdU19ezJ5wQQFTV5QD06uZzQ7EA=
 by: Cecil Westerhof - Sat, 12 Nov 2022 21:48 UTC

Pieter van Oostrum <pieter-l@vanoostrum.org> writes:

> Cecil Westerhof <Cecil@decebal.nl> writes:
>
>> In a document I have twelve times:
>> Some text
>>
>> \begin{figure}[h]
>> \adjustimage{width = \textwidth}{imageName}
>> \centering
>> \end{figure}
>> \vspace{\baselineskip}
>>
>> Could I write a function to be called like:
>> \placeImage{Some text}{imageName}
>>
>> Would be more clear and easier to maintain.
>>
>
> That's what macros are for:
>
> \newcommand\placeImage[2]{%
> #1
>
> \begin{figure}[h]
> \adjustimage{width = \textwidth}{#2}
> \centering
> \end{figure}
> \vspace{\baselineskip}
> }

Works like a charm. Thanks.

Just one question:
Why do you use a % at:
\newcommand\placeImage[2]{%

When I remove it, it does not seem to make a difference.

--
Cecil Westerhof
Senior Software Engineer
LinkedIn: http://www.linkedin.com/in/cecilwesterhof

Re: Function for boilerplate

<m2cz9q78zl.fsf@vanoostrum.org>

  copy mid

https://www.rocksolidbbs.com/computers/article-flat.php?id=5641&group=comp.text.tex#5641

  copy link   Newsgroups: comp.text.tex
Path: i2pn2.org!i2pn.org!aioe.org!news.mb-net.net!open-news-network.org!news.mind.de!bolzen.all.de!fu-berlin.de!uni-berlin.de!individual.net!not-for-mail
From: pieter-l@vanoostrum.org (Pieter van Oostrum)
Newsgroups: comp.text.tex
Subject: Re: Function for boilerplate
Date: Mon, 14 Nov 2022 00:03:26 +0100
Lines: 49
Message-ID: <m2cz9q78zl.fsf@vanoostrum.org>
References: <878rkglapj.fsf@munus.decebal.nl> <m2leognq63.fsf@vanoostrum.org>
<87bkpbkfo8.fsf@munus.decebal.nl>
Mime-Version: 1.0
Content-Type: text/plain
X-Trace: individual.net 34ui7Z4FCa7UA0OXnfSecAJk9wvmV9B64nI0roNpjs6I+0+QXz
Cancel-Lock: sha1:K7KhRGInciHMq61QytN3zpBcjt4= sha1:fXM4yUKz9N7haNmBIRY8BNjl1gc=
User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/28.2 (darwin)
 by: Pieter van Oostrum - Sun, 13 Nov 2022 23:03 UTC

Cecil Westerhof <Cecil@decebal.nl> writes:

> Pieter van Oostrum <pieter-l@vanoostrum.org> writes:
>
>> Cecil Westerhof <Cecil@decebal.nl> writes:
>>
>>> In a document I have twelve times:
>>> Some text
>>>
>>> \begin{figure}[h]
>>> \adjustimage{width = \textwidth}{imageName}
>>> \centering
>>> \end{figure}
>>> \vspace{\baselineskip}
>>>
>>> Could I write a function to be called like:
>>> \placeImage{Some text}{imageName}
>>>
>>> Would be more clear and easier to maintain.
>>>
>>
>> That's what macros are for:
>>
>> \newcommand\placeImage[2]{%
>> #1
>>
>> \begin{figure}[h]
>> \adjustimage{width = \textwidth}{#2}
>> \centering
>> \end{figure}
>> \vspace{\baselineskip}
>> }
>
> Works like a charm. Thanks.
>
> Just one question:
> Why do you use a % at:
> \newcommand\placeImage[2]{%
>
> When I remove it, it does not seem to make a difference.

I routinely insert a % after the opening brace of a macro definition if
it ends the line to prevent unwanted spaces creeping in. They aren't
always necessary, but better safe than sorry.

--
Pieter van Oostrum <pieter@vanoostrum.org>
www: http://pieter.vanoostrum.org/
PGP key: [8DAE142BE17999C4]

Re: Function for boilerplate

<87mt8uhrhh.fsf@munus.decebal.nl>

  copy mid

https://www.rocksolidbbs.com/computers/article-flat.php?id=5643&group=comp.text.tex#5643

  copy link   Newsgroups: comp.text.tex
Path: i2pn2.org!i2pn.org!eternal-september.org!reader01.eternal-september.org!.POSTED!not-for-mail
From: Cecil@decebal.nl (Cecil Westerhof)
Newsgroups: comp.text.tex
Subject: Re: Function for boilerplate
Date: Mon, 14 Nov 2022 09:26:02 +0100
Organization: Decebal Computing
Lines: 18
Message-ID: <87mt8uhrhh.fsf@munus.decebal.nl>
References: <878rkglapj.fsf@munus.decebal.nl> <m2leognq63.fsf@vanoostrum.org>
<87bkpbkfo8.fsf@munus.decebal.nl> <m2cz9q78zl.fsf@vanoostrum.org>
MIME-Version: 1.0
Content-Type: text/plain
Injection-Info: reader01.eternal-september.org; posting-host="db624f3d2345a068f3ca3d15278b9957";
logging-data="1818517"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX19saZ8BH8/0dns1d69SHVQDCSayMRJghUs="
User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/27.1 (gnu/linux)
Cancel-Lock: sha1:+16SY2PQ1GYNTNMWTFsIRE6shfI=
sha1:+3OTJ9oySKq4J7hC6quAsbyrSZQ=
 by: Cecil Westerhof - Mon, 14 Nov 2022 08:26 UTC

Pieter van Oostrum <pieter-l@vanoostrum.org> writes:

>> Just one question:
>> Why do you use a % at:
>> \newcommand\placeImage[2]{%
>>
>> When I remove it, it does not seem to make a difference.
>
> I routinely insert a % after the opening brace of a macro definition if
> it ends the line to prevent unwanted spaces creeping in. They aren't
> always necessary, but better safe than sorry.

OK, I understand.

--
Cecil Westerhof
Senior Software Engineer
LinkedIn: http://www.linkedin.com/in/cecilwesterhof

1
server_pubkey.txt

rocksolid light 0.9.8
clearnet tor