0

I am using the Astronomy and Astrophysics template and want to add code at the bottom in a single column appendix. I have tried this by doing this.

\onecolumn
\appendix
\section{Software use examples in IDL} \label{app:IDL}
Testing COCOPLOT in IDL

\lstset{language=IDL,
    basicstyle=\ttfamily,
    keywordstyle=\color{red}\ttfamily,
    stringstyle=\color{magenta}\ttfamily,
    commentstyle=\color{blue}\ttfamily,
    morecomment=[1][\color{pink}]}
\lstinputlisting{code.pro}

\section{Software use examples in PYTHON} \label{app:PYTHON}
\lstinputlisting{code.pro}

However, for some reason it adds a gigantic whitespace at the top of the page, but does not when using it later. (e.g. Appendix A for IDL code looks horrible but B where I included the same code looks fine.) enter image description here

  • 2
    Please provide a minimal working example. It will be better for you to get more people engaging and for us to see what is the cause of the problem. – M. Al Jumaily May 15 at 8:59
2

there must be something special in your additional (not shown) code because it should not have such whitespace. Your shown code has no problem:

\documentclass{article}
\usepackage{listings}
\usepackage{xcolor}
\begin{document}

    \appendix
    \section{Software use examples in IDL} \label{app:IDL}
    Testing COCOPLOT in IDL

    \lstset{language=IDL,
        basicstyle=\ttfamily,
        keywordstyle=\color{red}\ttfamily,
        stringstyle=\color{magenta}\ttfamily,
        commentstyle=\color{blue}\ttfamily,
        morecomment=[1][\color{pink}]}
%   \lstinputlisting{code.pro}
    \lstinputlisting{demo.bib}

    \section{Software use examples in PYTHON} \label{app:PYTHON}
%   \lstinputlisting{code.pro}
    \lstinputlisting{demo.bib}

\end{document}

enter image description here

0

I solved it and wanted to leave this up for future generations as its a very weird solution. You place the code on a minipage and the minipage inside the figure enviroment.

\begin{figure*}
\begin{minipage}{1\textwidth}
\section{Software use examples in IDL} \label{app:IDL}
Testing COCOPLOT in IDL
\lstinputlisting{code.pro}
  \end{minipage}
\end{figure*}
  • 1
    nor your question nor your answer we are not able to test, since you provide only fragments of code. please extend both to complete small document, which shows the problem and solution works. so far we are not able to confirm nor your problem nor your solutions. – Zarko May 15 at 9:51
  • 1
    furthermore: in question you change page layout to one column, here you use *figure*˙, which span two columns and in usual circumstances (depends on used packages) appear on the top of the next page. – Zarko May 15 at 9:54

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