I´m generating any grpahs... and I´m playing with any linewidhts values so I would like to type on the beginning of the .TEX a line similar to


to avoid chaging all the values of linewidth trough all the lines in the graphs. So, I would change only, and I view all the lines with that width.


How can I do this?

I suposse this is easy, but I can´t find the answer.

-- That´s my doubt --- and in the next lines I type my .tex file, where I can´t reach a good way to do an amount as a parameter

\usepackage[top=2.5cm, left=3.5cm, bottom=2.5cm, right=2.5cm]{geometry}  % Margenes de la normativa TFG

\usepackage{setspace} % para que no afecte el interlineado a las notas de pié de página


\hypersetup{colorlinks=true, urlcolor=blue}

\usepackage{mathpazo}       % Fuente MathPazo
\usepackage{datetime}       % paquete para configurar formato de fecha y hora
% ----------------------  PSTRICKS ---------------
% -------- Paquetes de pst-all \usepackage{pst-all}   paquete pstricks para las figuras en postcript
% ---- Fin Paquetes de pst-all

w1=0.085cm          (HERE I WANT TO DEFINE A PARAMETER)
w2=0.1cm                (HERE I WANT TO DEFINE A PARAMETER)
w3=0.15cm             (HERE I WANT TO DEFINE A PARAMETER)
w4=0.30cm            (HERE I WANT TO DEFINE A PARAMETER)

  \begin{pspicture}(-0,-0)(7.28,4.5) %\malla


 \ncline[linewidth=w1]{-}{1}{2}\naput{\scriptsize $2$} (IN THIS LINE I WANT TO USE A PARAMETER)
 \ncline{-}{1}{3}\naput{\scriptsize $6$}
 \ncline{-}{1}{4}\naput{\scriptsize $4$}
 \ncline{-}{1}{5}\naput{\scriptsize $6$}
 \ncline{-}{2}{4}\naput{\scriptsize $7$}
 \ncline[linewidth=w2]{-}{2}{3}\naput{\scriptsize $3$} (IN THIS LINE I WANT TO USE A PARAMETER)
 \ncline[linewidth=w3]{-}{3}{4}\naput{\scriptsize $5$} (IN THIS LINE I WANT TO USE A PARAMETER)
 \ncline{-}{3}{5}\naput{\scriptsize $4$}
 \ncline{-}{3}{6}\naput{\scriptsize $9$}
 \ncline{-}{3}{7}\naput{\scriptsize $3$}
 \ncline{-}{4}{6}\naput{\scriptsize $3$}
 \ncline[linewidth=0.12cm]{-}{4}{5}\naput{\scriptsize $4$}
 \ncline[linewidth=0.12cm]{-}{5}{6}\naput{\scriptsize $6$}
 \ncline{-}{5}{7}\naput{\scriptsize $8$}
 \ncline[linewidth=0.12cm]{-}{6}{7}\naput{\scriptsize $4$}

 \nccurve[angleA=335,angleB=255,linewidth=0.12cm]{-}{1}{7}\naput{\scriptsize $4$}

  • 1
    width1=0.32cm and width2=\dimexper\0.2\width1\relax is what you want? – user11232 Apr 15 '14 at 11:01
  • @HarishKumar: I think the question is more about defining new keys with PSTricks. – Claudio Fiandrino Apr 15 '14 at 11:09
  • \harish-kumar That solutions gives me problem!! No solution – Mika Ike Apr 15 '14 at 11:56
  • @Mika Could you please edit your post and make it fully compilable example? It would help the solvers tremendously. – Malipivo Apr 15 '14 at 12:04
  • \malipivo ok, I have done it, but we have just the solution by Christoph – Mika Ike Apr 15 '14 at 12:42

With PSTricks you can use \pslinewidth, which is the current linewidth. If you use that through the document, you can later scale the linewidth of all lines.



If you want to change the line properties of only a few lines, you can use e.g. \newpsstyle to define some line styles at one, centralized point in your document:


\newpsstyle{LineA}{linewidth=2\pslinewidth, linecolor=green}
\newpsstyle{LineB}{linewidth=3\pslinewidth, linecolor=red}

enter image description here

Just to mention a few possibilities.

  • Fantastic Solution!! Thank you. This is neccessary defined in each pstricks image, or Can I define for all the .TEX for every pstricks images. – Mika Ike Apr 15 '14 at 12:43
  • 1
    You can of course define a file mysettings.tex which contains only the \newpsstyle or \newpsobject (see Herbert's answer) definitions and load that into every other file with \input{mysettings}. – Christoph Apr 15 '14 at 12:49
  • a curisity !! for objects and styles You must use \newpsobjet and \newpsstyle. and... where can I find more things that can be defined in the way you show me? – Mika Ike Apr 15 '14 at 14:14
\newpsobject{pslineA}{psline}{linewidth=6\pslinewidth, linecolor=green}
\newpsobject{pslineB}{psline}{linewidth=10\pslinewidth, linecolor=red}


enter image description here

  • Thank you. I´m sorry for not be available choose 2 answers as THE ANSWER! It´s fantastic have 2 good answers. – Mika Ike Apr 15 '14 at 13:45

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.