Text FormattingTypes of Macros

Information and discussion about LaTeX's general text formatting features (e.g. bold, italic, enumerations, ...)
Post Reply
LaTexLearner
Posts: 139
Joined: Tue Mar 10, 2015 11:06 am

Types of Macros

Post by LaTexLearner »

The StackExchange thread on macros for beginners recommends the following be learned first.

Code: Select all

\newcommand
\newcommand*
\renewcommand
\renewcommand*
\providecommand
\providecommand*
\newenvironment
\newenvironment*
\renewenvironment
\renewenvironment*
I'm a beginner, though, and have already needed to learn other macros that never would have occurred to me, such as:

Code: Select all

\newcolumntype
\let
\newlength


Is there a comprehensive directory of macro commands out there? Or maybe a slightly longer list of macro commands I should learn first?
Last edited by LaTexLearner on Mon Jun 08, 2015 7:32 am, edited 1 time in total.

Recommended reading 2024:

LaTeXguide.org • LaTeX-Cookbook.net • TikZ.org

NEW: TikZ book now 40% off at Amazon.com for a short time.

And: Currently, Packt sells ebooks for $4.99 each if you buy 5 of their over 1000 ebooks. If you choose only a single one, $9.99. How about combining 3 LaTeX books with Python, gnuplot, mathplotlib, Matlab, ChatGPT or other AI books? Epub and PDF. Bundle (3 books, add more for higher discount): https://packt.link/MDH5p

LaTexLearner
Posts: 139
Joined: Tue Mar 10, 2015 11:06 am

Re: Types of Macros

Post by LaTexLearner »

p.s. What is the best way to insert links into these posts?
User avatar
Johannes_B
Site Moderator
Posts: 4182
Joined: Thu Nov 01, 2012 4:08 pm

Types of Macros

Post by Johannes_B »

This is a question with no clear answer, sorry.

We have TeX, which comes with \def. def defines stuff, no matter what.

Then, there was LaTeX2e, which give somehow a fail-back mechanism. f a command is already defined, an error, or a warning is issued.

Later, there was LaTeX3, coming with even more commands.

What to choose? Depends ... Suppoters sometimes use what they need, just to get the job done. It is not always the best solution.

Stuff like \newcolumntype build on top of def, and newcommand and ...

What to choose when and where, almost impossible to know for a newcommer. No, sorry, impossible to know. Best way is to read and learn, just as i am doing right now.
The smart way: Calm down and take a deep breath, read posts and provided links attentively, try to understand and ask if necessary.
User avatar
Stefan Kottwitz
Site Admin
Posts: 10335
Joined: Mon Mar 10, 2008 9:44 pm

Types of Macros

Post by Stefan Kottwitz »

LaTexLearner wrote:What is the best way to insert links into these posts?
I usually type the text for the link (or copy the text from the title of a page), double click it so it's highlighted, and click the [b]URL[/b] button above the edit field. Then I add the actual link by inserting =http://.. so in the edit field a link looks like:

Code: Select all

[url=http://texample.net/]TikZ gallery[/url]
I like it because I can make the link text fit to my own text flow.

You can also click the [b]URL[/b] button, to get the bbcode

Code: Select all

[url][/url]
and complete. I prefer the double click way, usually. Anyway, it's a bit clicking (but quickly becomes routine) and I like well written forum posts.

Stefan
LaTeX.org admin
User avatar
Stefan Kottwitz
Site Admin
Posts: 10335
Joined: Mon Mar 10, 2008 9:44 pm

Types of Macros

Post by Stefan Kottwitz »

LaTexLearner wrote:recommends the following be learned first
\newcommand
Yes, it should be one of the first macros. LaTeX beginners are usually authors, not programmers. An author should learn how to use a document class, and how to customize the document using class settings. With KOMA-Script classes, very many things can be customized by class options already. Then, an author may add his or her own macros for text pieces and especially for certain markup / formatting. This is not yet the hacking or programming stage, so you don't need \newlenght or such. Then \renewcommand can be useful in addition, to redefine something existing which you would like to modify for your document requirements.

Stefan
LaTeX.org admin
LaTexLearner
Posts: 139
Joined: Tue Mar 10, 2015 11:06 am

Types of Macros

Post by LaTexLearner »

Stefan_K wrote:
LaTexLearner wrote:What is the best way to insert links into these posts?
I usually type the text for the link (or copy the text from the title of a page), double click it so it's highlighted, and click the [b]URL[/b] button above the edit field. Then I add the actual link by inserting =http://.. so in the edit field a link looks like:

Code: Select all

[url=http://texample.net/]TikZ gallery[/url]
I like it because I can make the link text fit to my own text flow.

You can also click the [b]URL[/b] button, to get the bbcode

Code: Select all

[url][/url]
and complete. I prefer the double click way, usually. Anyway, it's a bit clicking (but quickly becomes routine) and I like well written forum posts.

Stefan
Got it!

I think I "fixed" it in my original post, too.
LaTexLearner
Posts: 139
Joined: Tue Mar 10, 2015 11:06 am

Types of Macros

Post by LaTexLearner »

Stefan_K wrote:
LaTexLearner wrote: recommends the following be learned first
\newcommand
Yes, it should be one of the first macros. LaTeX beginners are usually authors, not programmers. An author should learn how to use a document class, and how to customize the document using class settings. With KOMA-Script classes, very many things can be customized by class options already....
What are KOMA Script classes?
User avatar
Johannes_B
Site Moderator
Posts: 4182
Joined: Thu Nov 01, 2012 4:08 pm

Types of Macros

Post by Johannes_B »

The standard classes like article, report and book (and letter) come with some options the user can set.
KOMA has equivalent classes, but heavily, heavily extended. Most of the options can be changed mid-document without much effort using a pretty simple key-value interface.

It will be worth taking a look, though the manual (scrguien) is huge. It has to be huge due to the many many predefined and changeable settings.
The smart way: Calm down and take a deep breath, read posts and provided links attentively, try to understand and ask if necessary.
Post Reply