I have a eskdi.sty style file where I define two command:

  \ifnum #1 = 1% 1 - text; 2 - logo

And in another ESKD_frames.sty style file:

\ifx \gostorganizatiaopt text%
  \spformedboxmm{150}{16}{170}{4.0}{s}{\includegraphics*[keepaspectratio=true, height=10mm]{\@gostorganizatialogo}}%

Macro spformedboxmm draw #6 argument between x1-x2 and y1,y2 with parameter s.

Usage in a title.tex:

\gostorganizatia{1}{some text}% for drawing text

or to draw float figure


What is the best way to define global variable to use it in a different *.sty files?


In a main.log there are few error:

! Undefined control sequence. ...age LaTeX Error: File \@gostorganizatialogo ' not found.** and **! LaTeX Error: File' not found.

It seems to me that \gostorganizatiaopt does not work.

  • 1
    your question is not very clear, what do you need to define? After \newcommand{\gostorganizatia}[2] the macro takes two arguments so the use should be \gostorganizatia{1}{some text} not \gostorganizatia{1, some text} note also you are missing % from ends of lines in the definition \gdef\@gostorganizatiaoption{1} should be \gdef\@gostorganizatiaoption{1}% and same for {2} – David Carlisle May 31 '16 at 11:53
  • Ok, I'll check it, maybe it's my syntax error – Ulrich Von Rekkenin May 31 '16 at 12:14
  • Also, asking a question of the form "What is the best way..." requests subjective input as there may be no best way, or different people think their own solution is best. – Werner May 31 '16 at 14:30

You think that

\ifx \gostorganizatiaopt text%

test whether \gostorganizatiaopt is being compared to text. However, it's actually being compared to t, and it will never be true in your case. If you want a text-comparison, use the e-TeX \pdfstrcmp{<strA>}{<strB>} which returns 0 if <strA> = <strB>:

  % TRUE <text>
  % FALSE <logo>

A counter is the best way for me.

In the eskdi.sty file declare macro

\newcounter{gostorgcounter}% 0=text; 1=logo
  \ifnum\thegostorgcounter=0% 0 - text; 1 - logo

In a drawing file the follow construction:

\ifnum\thegostorgcounter=0% text mode
  \spboxmm{125}{10}{170}{4.0}{lc}{\parbox{70mm}{\centering \gostorganizatiatext{}}}
\ifnum\thegostorgcounter=1% logo mode

Usage \gostorganizatia{0}{some text} for text mode or \gostorganizatia{1}{./path_to_logo.jpg} for image.

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.