Take the 2-minute tour ×
TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

I have used cleveref package for referring to equations, figures, etc in an article. However, I wish to compile my tex file on another system which only has a basic version of tex. I wish to make my tex file sort of stand-alone .

Is there any way I can use a code which will look at my use of formatting references and replace all \cref commands with \ref commands but in the appropriate format.

Ex. when I use:

\crefformat{figure}{Fig.~(#2{}#1{}#3)}
\crefformat{section}{Sec.~(#2{}#1{}#3)}
\crefformat{equation}{Eq.~(#2{}#1{}#3)}

It should replace the instances of:

\cref{fig:label-for-fig}
\cref{eq:label-for-eq}
\cref{sec:label-for-sec}

by:

Fig. \ref{fig:label-for-fig}
Eq. \ref{eq:label-for-eq}
Sec. \ref{sec:label-for-sec}

(respectively).

Can anyone suggests a code that already exists ? Any language is ok if I can manage to run it on my system.

share|improve this question
    
An option could be to use boundle-doc which is a script that collects from your system all the files needed for the compilation of your document and packages them so that you can compile it in another system even if it lacks some packages. –  Bordaigorl Oct 9 '13 at 17:07
1  
Alternatively, you can just copy the .sty file of cleveref to your document's directory. –  Bordaigorl Oct 9 '13 at 17:09
    
@Bordaigorl Sorry if I wasn't clear. I intend to make the tex file compile as a single file, without needing any style files, etc. I want the directory to have just the tex file and the images it needs. –  Pavithran Iyer Oct 9 '13 at 17:15
    
Well, the arlatex script in bounde-doc may still help... –  Bordaigorl Oct 9 '13 at 17:31
    
I'd be tempted to call this a duplicate of Lightweight equivalent of \cref and \Cref; please confirm if this resolves the issue, and we can close it :) Otherwise, please say how your question is different –  cmhughes Oct 9 '13 at 18:42
show 1 more comment

1 Answer

Trying to reproduce the behavior of cleveref without having it is just a waste of time and hopeless: it's a large package and does things in a, well, clever way.

I don't think you'll use the system with the basic TeX distribution for producing the final version of your document, so delving with those prefixes has dubious usefulness.

Just add to your preamble

\IfFileExists{cleveref.sty}
  {\usepackage{cleveref}}
  {\let\cref\ref\newcommand\crefformat[2]{}}

and that would be all.

share|improve this answer
    
+1 but I think poormans version is the way to go, as in Lightweight equivalent of \cref and \Cref –  cmhughes Oct 9 '13 at 18:46
    
@cmhughes - the poorman's method is a one-way street. I believe the OP is looking for a (sadly nonexistent) method by which his/her \cref commands produce the same output on machines with and without the cleveref package being present. –  Mico Oct 10 '13 at 4:21
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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