[Tex/LaTex] conference header is applied to all pages

header-footerieeetran

My current code (which is basically @Werner's touch) adds the title to every page, whereas it must only be added to the first page.

Could you please give me some advice to fix this problem?

I can add \thispagestyle{empty} to other pages to get rid of the headers. But it sounds like a dirty solution!

%% bare_conf.tex
%% V1.4b
%% 2015/08/26
\documentclass[conference]{IEEEtran}

\usepackage[mathlines,switch]{lineno}

\makeatletter

%%%%%%%%%%%for copyright notice
\def\ps@IEEEtitlepagestyle{%
    \def\@oddfoot{\mycopyrightnotice}%
    \def\@evenfoot{}%
}
\def\mycopyrightnotice{%
    {\footnotesize  978-1-4799-6773-5/14/\$31.00 \textcopyright2017 Crown\hfill}
    \gdef\mycopyrightnotice{}
}
%%%%%%%%%%%

\let\old@ps@headings\ps@headings
\let\old@ps@IEEEtitlepagestyle\ps@IEEEtitlepagestyle
\def\confheader#1{%
    % for all pages except the first
    \def\ps@headings{%
        \old@ps@headings%
        \def\@oddhead{\strut\hfill#1\hfill\strut}%
        \def\@evenhead{\strut\hfill#1\hfill\strut}%
    }%
    % for the first page
    \def\ps@IEEEtitlepagestyle{%
        \old@ps@IEEEtitlepagestyle%
        \def\@oddhead{\strut\hfill#1\hfill\strut}%
        \def\@evenhead{\strut\hfill#1\hfill\strut}%
    }%
    \ps@headings%
}
\makeatother

\confheader{%
        \parbox{20cm}{2017 14th International Conference on Electrical Engineering, Computing Science and Automatic Control (CCE)\\, Mexico, City. Mexico. September 20-22, 2017.}
}

\begin{document}

    \title{X}

    \author{\IEEEauthorblockN{{X}
            \IEEEauthorblockA{H}\\
            J\\
            I\\
            Email: a@b.c}
    }

    \maketitle

    \begin{abstract}

    \end{abstract}

    \IEEEpeerreviewmaketitle

\end{document}

Best Answer

You are using the same \@oddhead and \@evenhead for all pages...

So substitute the lines

\let\old@ps@headings\ps@headings
\let\old@ps@IEEEtitlepagestyle\ps@IEEEtitlepagestyle
\def\confheader#1{%
    % for all pages except the first
    \def\ps@headings{%
        \old@ps@headings%
        \def\@oddhead{\strut\hfill#1\hfill\strut}%
        \def\@evenhead{\strut\hfill#1\hfill\strut}%
    }%
    % for the first page
    \def\ps@IEEEtitlepagestyle{%
        \old@ps@IEEEtitlepagestyle%
        \def\@oddhead{\strut\hfill#1\hfill\strut}%
        \def\@evenhead{\strut\hfill#1\hfill\strut}%
    }%
    \ps@headings%
}

with simply

\let\old@ps@IEEEtitlepagestyle\ps@IEEEtitlepagestyle
\def\confheader#1{%
    % for the first page
    \def\ps@IEEEtitlepagestyle{%
        \old@ps@IEEEtitlepagestyle%
        \def\@oddhead{\strut\hfill#1\hfill\strut}%
        \def\@evenhead{\strut\hfill#1\hfill\strut}%
    }%
    \ps@headings%
}

MWE:

%% bare_conf.tex
%% V1.4b
%% 2015/08/26
\documentclass[conference]{IEEEtran}

\usepackage[mathlines,switch]{lineno}

\usepackage{lipsum}

\makeatletter

%%%%%%%%%%%for copyright notice
\def\ps@IEEEtitlepagestyle{%
    \def\@oddfoot{\mycopyrightnotice}%
    \def\@evenfoot{}%
}
\def\mycopyrightnotice{%
    {\footnotesize  978-1-4799-6773-5/14/\$31.00 \textcopyright2017 Crown\hfill}
    \gdef\mycopyrightnotice{}
}
%%%%%%%%%%%

\let\old@ps@IEEEtitlepagestyle\ps@IEEEtitlepagestyle
\def\confheader#1{%
    % for the first page
    \def\ps@IEEEtitlepagestyle{%
        \old@ps@IEEEtitlepagestyle%
        \def\@oddhead{\strut\hfill#1\hfill\strut}%
        \def\@evenhead{\strut\hfill#1\hfill\strut}%
    }%
    \ps@headings%
}
\makeatother

\confheader{%
        \parbox{20cm}{2017 14th International Conference on Electrical Engineering, Computing Science and Automatic Control (CCE)\\, Mexico, City. Mexico. September 20-22, 2017.}
}

\begin{document}

    \title{X}

    \author{\IEEEauthorblockN{{X}%
            \IEEEauthorblockA{H}\\
            J\\
            I\\
            Email: a@b.c}
    }

    \maketitle

    \begin{abstract}

    \end{abstract}

    \IEEEpeerreviewmaketitle

    \lipsum[1-10]

\end{document} 

Output:

enter image description here