0

I am writing multiple documents like paper.tex, report.tex, book.tex etc. They all have different formats like single/double column, landscape/portrait etc.

All these (wrapper like) document tex files, include a single core contents file called "content.tex". Thus, this content gets formatted according to different formats declared by the wrapper tex files.

Question is: I wish to have a table inside content.tex, which gets displayed, only as single-column-full-paper-width and landscape mode, irrespective of wrapper tex's settings.

Possible?

Tried: Before this table I can say \onecolumn. But at the end of the table, I would not know whether to reset it to \onecolumn or \twocolumn as content.tex is not aware of who is including it.

  • Have you tried the table* environment? It acts like a table environment, but is full-width. – Mico Jun 24 '15 at 6:01
  • Is this table the same for all of them? What about the page that it's on? If all things remain the same, create a single, stand-alone PDF and include the table using pdfpages. – Werner Jun 24 '15 at 6:03
  • This table and the file within which it resides, content.tex is same for all the wrapper documents. Basically I wish to get the essay(content) displayed in different format, but the table has only specific format in all the docs. – Yogesh Kulkarni Jun 24 '15 at 6:15
3

Single/double column detection

LaTeX maintains a switch \if@twocolumn for the status of two column mode. An example for the detection of the column mode with restoring the previous setting can be found in the definition for the index, e.g. article.cls:

\newenvironment{theindex}{%
  \if@twocolumn
    \@restonecolfalse
  \else
    \@restonecoltrue
  \fi
  \twocolumn[\section*{\indexname}]%
  ...
}{%
  \if@restonecol
    \onecolumn
  \else
    \clearpage
  \fi
}

In a similar way, a environment can be defined to set its contents in one column mode:

\makeatletter
\newenvironment{one-column}{%
  \if@twocolumn
    \def\restorecolumnmode{\twocolumn\relax}%
    \onecolumn
  \else
    \def\restorecolumnmode{\clearpage}%
  \fi
}{%
  \restorecolumnmode
}

Detecting landscape setting

If option landscape is set (class option, package geometry, ...), then the paper width is larger than paper height, which can be detected by a comparison in \ifdim:

\ifdim\paperwidth>\paperheight
  % landscape setting
\else
  % portrait setting
\fi
| improve this answer | |

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.