GeneralChange standard arguments of \newcommand

LaTeX specific issues not fitting into one of the other forums of this category.
Post Reply
Thomas_l
Posts: 6
Joined: Fri Apr 19, 2013 3:13 pm

Change standard arguments of \newcommand

Post by Thomas_l »

Hi All

I am working on a presentation and have to use a load of references. These references looks like this:
  • par. 4.4.1 blz 4.30 - 4.31
So i defined my one command t do this automaticaly to get this result:
  • \verw{4.2.2}{4.6}{4.7} => par. 4.2.2 blz. 4.6 - 4.7
Whenever i use this function i get the standard form:
  • \verw{arg1}{arg2}{arg3}
Is there a way to change this form to:
  • \verw{section}{startpage}{endpage}
This would make it a load easyer for me to remember what i have to put where in the command.

Regards

Thoams
Last edited by cgnieder on Fri Apr 19, 2013 5:14 pm, 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

cgnieder
Site Moderator
Posts: 2000
Joined: Sat Apr 16, 2011 7:27 pm

Change standard arguments of \newcommand

Post by cgnieder »

Hi Thomas,

Welcome to the LaTeX community!

It is of course possible to program a command with a different syntax. The question is: which syntax would you like?

Edit: I realized I misread your question... and I must admit I am not 100% sure I got what you want. Could you please post a Infominimal working example?

Regards
site moderator & package author
User avatar
sommerfee
Posts: 503
Joined: Mon Apr 09, 2007 4:20 pm

Change standard arguments of \newcommand

Post by sommerfee »

Thomas_l wrote:Whenever i use this function i get the standard form:
  • \verw{arg1}{arg2}{arg3}
Is there a way to change this form to:
  • \verw{section}{startpage}{endpage}
To me this seems to be a problem with your editor, not with LaTeX itself.

So what editor do you use?
Thomas_l
Posts: 6
Joined: Fri Apr 19, 2013 3:13 pm

Change standard arguments of \newcommand

Post by Thomas_l »

I atached a file which I hope brings a litle more clearity.
Knipsel.PNG
Knipsel.PNG (8.01 KiB) Viewed 6297 times
I used this source code (hope this is what you mean whit a minimal example)

Code: Select all

\documentclass{article}

\newcommand{\ref}[3]{par. #1 page: #2 - #3}

\begin{document}
\ref{arg1}{arg2}{arg3}
\ref{section}{starting page}{ending page}
\end{document}
To me this seems to be a problem with your editor, not with LaTeX itself.

So what editor do you use?
I use the Texstudio editor
Last edited by cgnieder on Sat Apr 20, 2013 10:13 am, edited 1 time in total.
User avatar
cgnieder
Site Moderator
Posts: 2000
Joined: Sat Apr 16, 2011 7:27 pm

Change standard arguments of \newcommand

Post by cgnieder »

Ok, so I did misunderstand your question and Axel was right. Unfortunately I don't have much experience with TeXstudio but I'll take a look when I'm home.

Regards
site moderator & package author
Thomas_l
Posts: 6
Joined: Fri Apr 19, 2013 3:13 pm

Change standard arguments of \newcommand

Post by Thomas_l »

cgnieder wrote:Ok, so I did misunderstand your question and Axel was right. Unfortunately I don't have much experience with TeXstudio but I'll take a look when I'm home.

Regards
So if I use another editor this would be possible?

Thanks in advance for looking into it.
User avatar
cgnieder
Site Moderator
Posts: 2000
Joined: Sat Apr 16, 2011 7:27 pm

Change standard arguments of \newcommand

Post by cgnieder »

Thomas_l wrote:So if I use another editor this would be possible?
I know for sure it is possible with Kile which isn't easy to install on Windows IIRC, though. I would think it should be doable with TeXstudio, too, but I have to wait until I am home where I have a Windows desktop so I can test it.

Regards
site moderator & package author
Post Reply