[OS X TeX] TeXShop: a way to automate terminating each line in a block with a comment symbol

Ross Moore ross.moore at mq.edu.au
Sun May 17 13:01:44 CEST 2020


Hello Murray,

On 17 May 2020, at 2:40 am, Murray Eisenberg <murrayeisenberg at gmail.com<mailto:murrayeisenberg at gmail.com>> wrote:

I have long blocks of code within a \newcommand{\cmdname}{…} definition that need to have each of the lines terminated with a comment sign (%).

Is there some way to select the block and apply that automatically?

Some trick I’ve missed? some macro I’ve overlooked?

My favourite motto is:
    “there’s always more than one way to do … “

Using a macro in the editor is one way, as Luis describes.

But you can get what you want entirely within TeX coding,
without adding any comment characters.

Just surround your definition block as follows.

\endlinechar=-1  %  suppress line endings from this point

\newcommand{\mylongmacro}{…
 …
 … }

\endlinechar=13    %  On a Mac the end-of-line character is  Ux0D  = ASCII 13


This kind of thing is normally done within package  .sty  files.
If you want to check the status of  \endlinechar  at any point, for whatever reason,
just use:

 \showthe\endlinechar



Hope this helps.
Stay safe.

Ross


---
Murray Eisenberg murrayeisenberg at gmail.com<mailto:murrayeisenberg at gmail.com>
503 King Farm Blvd #101 Home (240)-246-7240
Rockville, MD 20850-6667 Mobile (413)-427-5334


----------- Please Consult the Following Before Posting -----------
TeX FAQ: http://www.tex.ac.uk/faq<https://protect-au.mimecast.com/s/2dfMCwV1jpSogMDNCxeAet?domain=tex.ac.uk>
List Reminders and Etiquette: https://sites.esm.psu.edu/~gray/tex/<https://protect-au.mimecast.com/s/mgz4CxngGkfZP62XCgBEaF?domain=sites.esm.psu.edu>
List Archives: http://dir.gmane.org/gmane.comp.tex.macosx<https://protect-au.mimecast.com/s/9hB0Cyoj8PuYAvl4txFJzw?domain=dir.gmane.org>
https://email.esm.psu.edu/pipermail/macosx-tex/<https://protect-au.mimecast.com/s/iK8yCzvkmpfKOl0rC7NzuS?domain=email.esm.psu.edu>
TeX on Mac OS X Website: http://mactex-wiki.tug.org/<https://protect-au.mimecast.com/s/avHvCANpnDCjGyvRfwG7WB?domain=mactex-wiki.tug.org>
List Info: https://email.esm.psu.edu/mailman/listinfo/macosx-tex<https://protect-au.mimecast.com/s/zc7PCBNqgBCvzQgnCpx27C?domain=email.esm.psu.edu>


Dr Ross Moore
Department of Mathematics and Statistics
12 Wally’s Walk, Level 7, Room 734
Macquarie University, NSW 2109, Australia
T: +61 2 9850 8955  |  F: +61 2 9850 8114
M:+61 407 288 255  |  E: ross.moore at mq.edu.au<mailto:ross.moore at mq.edu.au>
http://www.maths.mq.edu.au
[cid:image001.png at 01D030BE.D37A46F0]
CRICOS Provider Number 00002J. Think before you print.
Please consider the environment before printing this email.

This message is intended for the addressee named and may
contain confidential information. If you are not the intended
recipient, please delete it and notify the sender. Views expressed
in this message are those of the individual sender, and are not
necessarily the views of Macquarie University. <http://mq.edu.au/>
<http://mq.edu.au/>

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://tug.org/pipermail/macostex-archives/attachments/20200517/e07615bd/attachment-0001.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: image001.png
Type: image/png
Size: 4605 bytes
Desc: image001.png
URL: <https://tug.org/pipermail/macostex-archives/attachments/20200517/e07615bd/attachment-0001.png>
-------------- next part --------------
----------- Please Consult the Following Before Posting -----------
TeX FAQ: http://www.tex.ac.uk/faq
List Reminders and Etiquette: https://sites.esm.psu.edu/~gray/tex/
List Archives: http://dir.gmane.org/gmane.comp.tex.macosx
                https://email.esm.psu.edu/pipermail/macosx-tex/
TeX on Mac OS X Website: http://mactex-wiki.tug.org/
List Info: https://email.esm.psu.edu/mailman/listinfo/macosx-tex


More information about the macostex-archives mailing list.