LaTeX forum ⇒ GeneralChange standard arguments of \newcommand

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

Change standard arguments of \newcommand

Postby Thomas_l » Fri Apr 19, 2013 3:26 pm

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.
Reason: added inline code markup

Tags:

User avatar
cgnieder
Site Moderator
Posts: 1988
Joined: Sat Apr 16, 2011 7:27 pm

Postby cgnieder » Fri Apr 19, 2013 5:17 pm

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
Clemens
------------------------------
chemmacros · chemformula · leadsheets · xsim

User avatar
sommerfee
Posts: 498
Joined: Mon Apr 09, 2007 4:20 pm

Postby sommerfee » Fri Apr 19, 2013 8:48 pm

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

Postby Thomas_l » Sat Apr 20, 2013 9:57 am

I atached a file which I hope brings a litle more clearity.
Knipsel.PNG
Knipsel.PNG (8.01 KiB) Viewed 3181 times


I used this source code (hope this is what you mean whit a minimal example)

  1. \documentclass{article}
  2.  
  3. \newcommand{\ref}[3]{par. #1 page: #2 - #3}
  4.  
  5. \begin{document}
  6. \ref{arg1}{arg2}{arg3}
  7. \ref{section}{starting page}{ending page}
  8. \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.
Reason: changed code markup from inline to block

User avatar
cgnieder
Site Moderator
Posts: 1988
Joined: Sat Apr 16, 2011 7:27 pm

Postby cgnieder » Sat Apr 20, 2013 10:17 am

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
Clemens
------------------------------
chemmacros · chemformula · leadsheets · xsim

Thomas_l
Posts: 6
Joined: Fri Apr 19, 2013 3:13 pm

Postby Thomas_l » Sat Apr 20, 2013 10:20 am

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: 1988
Joined: Sat Apr 16, 2011 7:27 pm

Postby cgnieder » Sat Apr 20, 2013 4:05 pm

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
Clemens
------------------------------
chemmacros · chemformula · leadsheets · xsim


Return to “General”

Who is online

Users browsing this forum: No registered users and 6 guests