Very Wide Tables in LaTeX - latex

Is there a way to have a table in LaTeX that spans multiple pages width-wise, rather than length-wise? As far as I can tell, both longtable and supertabular will break tables over multiple pages, but only by breaking between rows and I need to break between columns. Even better would be if it were possible to have a few columns repeated at on each page.

I am using this not so nice and manually configured code to split a too wide tabular:
\usepackage{tikz}
\newsavebox{\boxFinal}
\begin{lrbox}{\boxFinal}
\scalebox{0.6}{
\begin{tabular}{...}
...
\end{tabular}
}
\end{lrbox}
\begin{table}[htb]
\centering
\begin{tikzpicture}
\clip (0,-\dp\boxFinal) rectangle (0.5\wd\boxFinal,\ht\boxFinal);
\pgftext[left,base]{\usebox{\boxFinal}};
\end{tikzpicture}
\label{table_test1}\caption{Part 1 of 2.}
\end{table}
\begin{table}[htb]
\centering
\begin{tikzpicture}
\clip (0.5\wd\boxFinal,-\dp\boxFinal) rectangle
(\wd\boxFinal,\ht\boxFinal); \pgftext[left,base]{\usebox{\boxFinal}};
\end{tikzpicture}
\label{table_test2}\caption{Part 2 of 2.}
\end{table}
There is usually a need to manually correct split offsets. You can do this by adding or subtracting from 0.5\wd\boxFinal value.
The idea was taken from http://www.latex-community.org/forum/viewtopic.php?f=5&t=2867

I've been yanking my hair out with this same problem off and on for a week. I think that this may not be entirely possible in a non-hacky sort of way.
One possible hackly solution is to use the dpfloat package: http://www.ctan.org/tex-archive/help/Catalogue/entries/dpfloat.html
Unfortunately, you'd be creating multiple tables and breaking them manually, but at least the end result should look okay. Also, this will look much better if you ditch vertical rules in your tables as per the sage guidance in the booktabs package (which you will have to google because apparently I, as a new user, don't have enough reputation to post a link to the booktabs pdf manual).

A good solution would be to rotate the whole table 90 degrees counterclockwise, thus having more room for it.
Preamble \usepackage{pdflscape}
\newpage
\thispagestyle{empty}
\begin{landscape}
\begin{table}
...
\end{table}
\end{landscape}

Related

Two equal-height **minipages** in Latex Beamer?

I was looking for ways to have a side-by-side minipages on a Latex beamer.
I will be clear, this is not two columns or mult-column or whatever. I specifically need minipages.
To do so, I created a nice command/function which does it nicely, but I am trying to make the two miniapges always be equal in height as well.
Any suggestions on how to force them to be equal in size?
Also general improvement suggestions and tips are welcomed.
\def \MinSideBySideGap {0.02} % minimal Gap between left/right sides
\newcommand{\SideBySide}[3][0.5]
{
%
\ifthenelse{\isempty{#1}}%
{\FPeval{\leftwidth}{0.5-\MinSideBySideGap/2}%
\FPeval{\rightwidth}{\leftwidth}%
}% if #1 is empty
{\FPeval{\leftwidth}{min(#1-\MinSideBySideGap/2,1.0)}%
\FPeval{\rightwidth}{max(1.0-\leftwidth-\MinSideBySideGap,0.0)}
}% if #1 is not empty
%
% Left Part
\begin{minipage}{\leftwidth\textwidth}
#2
\end{minipage}%
\hfill%
% Right Part
\begin{minipage}{\rightwidth\textwidth}
#3
\end{minipage}%
}
Towards #samcarter_is_at_topanswers.xyz questions, this was the very old origin of this:
\newcommand{\SideBySide}[2]
{
\begin{columns}[T] % align columns
\begin{column}{.48\textwidth}
#1
\end{column}%
\hfill%
\begin{column}{.48\textwidth}
#2
\end{column}%
\end{columns}
}
I still don't see a reason why you would need minipages of the same height, but just as a proof of concept, you could use tcoloboxes instead of minipages. They have the ability to form "equal height groups":
\documentclass{beamer}
\usepackage[most]{tcolorbox}
\tcbset{width=(\linewidth-4mm)/2,before=,after={},enhanced,interior empty,equal height group=\insertframenumber,frame hidden}
\begin{document}
\begin{frame}
\begin{tcolorbox}%
test
\end{tcolorbox}%
\hfill%
\begin{tcolorbox}%
test
test
\end{tcolorbox}%
\end{frame}
\end{document}
(for the image, I removed the interior empty option so one can see the height of the box)

table float in 2 columns environment

I want to put a basic table into a 2-columns document.
I saw that instead of:
\begin{table}
enter code here
\end{table}
we should use:
\begin{table*}
enter code here
\end{table*}
but it is not working.
If anyone has an idea, thanks in advance! Below a minimal example.
\documentclass[10pt]{article}
\usepackage{lipsum}% fake text
\usepackage{multicol}% enable writing in 2 columns
\setlength{\columnsep}{7mm}% separation between the two columns
\setlength{\columnseprule}{1pt}% width of the separation lign(comment if not wanted)
\begin{document}
\begin{multicols}{2}
\lipsum[1]
\begin{table*}[t]
\begin{tabular}{cc}
A & b\\
c & d
\end{tabular}
\end{table*}
\end{multicols}
\end{document}
It seems that the document class is important.
If I change
article -> scrartcl
I can use the
\captionof{table}{my caption}
without using the table environment.
But I don't know if it is the right way to do it.
Floats and marginpars are not allowed inside multicols environment. Also, table* would be page wide. If you comment the table* environment, you get the tabular in the second column:
\documentclass[10pt]{article}
\usepackage{lipsum}% fake text
\usepackage{multicol}% enable writing in 2 columns
\setlength{\columnsep}{7mm}% separation between the two columns
\setlength{\columnseprule}{1pt}% width of the separation lign(comment if not wanted)
\begin{document}
\begin{multicols}{2}
\lipsum[1]
%\begin{table*}[t]
\begin{tabular}{cc}
A & b\\
c & d
\end{tabular}
%\end{table*}
\end{multicols}
\end{document}
Rather, you can nest the tabular inside a center environment and, if you need, use the package caption to label and reference your tabular although it's not a float.

Layout parallel columns in LaTeX?

I'm seeking to layout paragraphs as follows:
1. In the introduction, I'd have the paragraphs across all columns.
2. Then follow two columns with opposing opinions in parallel. It differs than a two-columns layout that the two columns will be parallel and that the content on the left will always remain on the left, the right always on the right across multiple pages. Even if the amount of argument of the left column is shorter, the argument of the right column should not float into the left column.
Here is an example in HTML:
https://www.biblegateway.com/passage/?search=1+Corinthians+15&version=CCB;KJ21
Used to compare different translations.
Below is my attempt to achieve the effect.
\documentclass{report}
\usepackage[english]{babel}
\usepackage{blindtext}
\begin{document}
\section{Introduction}
Here are the normal paragraph crossing colmuns.
\blindtext
\begin{minipage}[t]{0.5\textwidth}
\section{Argument on the Left}
Because I am on the left, so must I be not right?
\end{minipage}\begin{minipage}[t]{0.5\textwidth}
\section{Argument on the Right}
Because I am on the right, so I must be right!
\blindtext
\end{minipage}
\end{document}
It almost achieved the effect, except that there is no gap between the two columns.
Here is a screenshot of the result:
What would be a better solution?
How could I achieve the same in org-mode with export to PDF (via LaTex)?
To have separated columns, it is sufficient to use smaller minipages and to add a space between them. Minipages are boxes, and you can either use a fixed space (with ~~~ or \hspace{}), but the better is rubber space \hfill.
\usepackage[english]{babel}
\usepackage{blindtext}
\begin{document}
\section{Introduction}
Here are the normal paragraph crossing colmuns.
\blindtext
\noindent\begin{minipage}[t]{0.48\textwidth}
\section{Argument on the Left}
Because I am on the left, so must I be not right?
\end{minipage}%
\hfill%
\begin{minipage}[t]{0.48\textwidth}
\section{Argument on the Right}
Because I am on the right, so I must be right!
\blindtext
\end{minipage}
\end{document}
\noindent avoids the normal paragraph spacing and \hfill "pushes minipage towrads left and right margin.
But it is not the best solution. You will have problems to manage properly page breaks and there is a specific package to does exactly what you want.
The package paracol defines a parallel environment with 2 (or more) columns and provides a way to "synchronize" them by switching between cols. It takes care of page breaks and is definitely what you want.
Here is an example with paracol
\documentclass{report}
\usepackage[english]{babel}
\usepackage{blindtext}
\usepackage{paracol}
\begin{document}
\section{Introduction}
Here are the normal paragraph crossing colmuns.
\blindtext
\begin{paracol}{2}
\section{Argument on the\\ Left}
Because I am on the left, so must I be not right?
\switchcolumn
\section{Argument on the\\ Right}
Because I am on the right, so I must be right!
\blindtext
\end{paracol}
\end{document}
As you can see, section numbering is coherent between columns, but there are many ways to customize the package if you prefer not. Look at the documentation
Also note that I had to add a manual line break to have section titles properly formatted, but it is a minor drawback.
Concerning, org-mode, I use it, but I have no experience with export and cannot really help you. But with the flexibility of paracol, you can find some way to define macros that do what you need. Maybe if you provide a org-mode export, people can try to find a solution.

How to reduce the size of captions in all figures

I want the captions of my figures and table to have the same size as \footnotesize. Is there something to put in the preambule of my document to do this?
Use the caption package to set the font key-value to footnotesize:
\documentclass{article}
\usepackage{caption}
\captionsetup{font=footnotesize}
\begin{document}
Some regular text set in \verb|\normalsize|.
\begin{table}[t]
\caption{A table using \texttt{\string\footnotesize}.}
\end{table}
\begin{figure}[t]
\caption{A figure using \texttt{\string\footnotesize}.}
\end{figure}
\end{document}
It is also possible to adjust the label and text formats individually for figures and tables separately. However, consistency is a better option here.

Fullpage picture in two column layout

I'd like to insert a picture (figure) into a document which is using a two-column layout. However, I want it to take one whole page and not be centered on one of the columns. Currently if I add a [p] modifier to the figure, the whole image lands on the last page, instead in the middle of the document.
How can I force one page to switch back to a single-column layout and insert a single big picture there?
Use the figure* environment. So instead of
\begin{figure}[ht] % I typically use ht
\centering
...
\end{figure}
you should use
\begin{figure*}[ht]
\centering
...
\end{figure*}
This also works for tables (i.e. table*).
Consider this link for more information
It is not elegant, but with float package loaded you can use:
\begin{figure}[H]
\onecolumn\includegraphics{arc}
\end{figure}
\twocolumn
But you have to place this piece of code to exact locetion in source code. Otherwise you'll get pagebreak anywhere in twocolumned page, then page with image image.
To supplement #Crowley's answer, to avoid pagebreak after implementation.
Instead of using \twocolumn, use this package instead \usepackage{multicol}.
Then,
\begin{multicols}{2}
\section Write or place anything you want
\end{multicols}
This works for me!
\usepackage{multicol} in your preamble.
Then
\begin{document}
\begin{multicols}{2}
blah blah blah text
\end{multicols}
\begin{figure}[H]
\includegraphics[width=1\textwidth]{arc}
\end{figure}
\begin{multicols}{2}
blah blah blah text
\end{multicols}
\end{document}
This is ugly, and dirty. and you will need to fiddle with where you figure is in order to get the text balanced, but it is exactly what you asked for.

Resources