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.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I write a class. I'm interested in having a different page headers (and eventually make some other small differences) based on whether the class is used on the site arXiv.org or not. Minimal example follows:

myclass.cls

\ProvidesClass{myclass}[2013/02/27]

\LoadClass{article}
\date{}

\RequirePackage{fancyhdr}
\fancyhf{}
\fancyfoot[C]{\thepage}

%\ifABC
\fancyhead[C]{arXiv version}
%\fi

\pagestyle{fancy}
\g@addto@macro{\maketitle}{\thispagestyle{fancy}}

\endinput

testarticle.tex

\documentclass{myclass}

\title{Just an Article}
\author{Me the First}

\usepackage{lipsum}

\begin{document}

\maketitle

\lipsum[1-8]

\end{document}

In the file myclass.cls, the if conditional (disabled in MWE) should detect whether "arXiv or not". Since the class file will be used by many people I don't know, solution as bullet-proof as possible is welcomed, as well as just ideas that might need further development to work. My first idea was to detect at the beginning whether the package hyperref is loaded before the classfile is processed (since it's always loaded on arXiv), but it doesn't seem to work.

share|improve this question
1  
I'm not quite sure what you can use to detect what system things are being run on unless you know that there is some testable information set by the platform. Presumably that requires insight into the arXiv set up, which we can't really offer. – Joseph Wright Feb 27 '13 at 9:09
10  
\ifx\tikzversion\reallyreallyoutdated \arxivtrue \else \arxivfalse \fi – Loop Space Feb 27 '13 at 9:10
3  
@JosephWright arXiv does crazy things to the articles: disregards a4paper option sometimes, activates hyperref by default, adds the arXiv stamp on the first page etc. Some of them must be possible to detect. I'll look into it during the weekend if I don't get an answer here inbetween. – yo' Feb 27 '13 at 23:10
2  
The arXiv uses AutoTeX to process the files. You might check the documentation/source to see if it defines any macros you can use to check. – mforbes Mar 27 '13 at 5:59
    
@tohecz How do you test? Apart from days where I submit articles (with a frequency counted in tens of nanohertz), I don't see when I could. – Bruno Le Floch May 19 '13 at 1:38
up vote 3 down vote accepted

Without an explicit flag being set by the 'host' platform, there is no general way of detecting that a .tex file is being processed by a particular publisher's system. Thus without knowledge of the arXiv system, and probably contacts, there is no way to achieve this detection.

share|improve this answer

I posted a similar question on academia.se today and was pointed to this question. I posted a hack there which can work for your situation also.

Basically make a separate empty file called myclass.dont.upload.to.arxiv then use IfFileExists function in latex to test whether this file is present or not and take action accordingly. When you have to upload the paper to arxiv then don't upload this file. Problem Solved.

share|improve this answer
    
No, you discuss a situation in which you are the author of the paper. But I'm not. I'm the author of the LaTeX class. Whence, your solution can not work. – yo' May 1 at 12:03
    
Welcome to TeX.SX! As far as possible we like answers to be self-contained, and in particular not rely on links, as thi makes them easier to read and we don't have to worry about the links vanishing in the future. – Andrew May 1 at 12:03

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.