Hot answers tagged

260

The following suggestions are applicable to tabular- and array-like structures and for the most past applies to both text and math mode, including *matrix environments. Vertical padding Vertical padding is possible in a global way using @Herbert's answer. That is, to redefine the array stretch factor <factor> using \renewcommand{\arraystretch}{<...


94

An align is a table-like structure, and & is a column separator. The thing is that the columns in an align are rlrlrlrlrl..., that is, every other column is right aligned and left aligned. So, in a &= b the a is in a right aligned column, while =b is left aligned. When you do a &= b & text text will be in a right aligned column, but ...


92

For table* and figure*, the only available options are t (top of next page) or p (end of document). b and h have been disabled on purpose, there is probably a strong typographical reason behind it. Since you state that the placement on the bottom of the page is "not necessary", I suggest you use the [t] option instead of [b]. Note that the table may ...


84

Since you want multiple columns, you should use the multicol package: Code: \documentclass{article} \usepackage{multicol} \begin{document} Two columns: \begin{multicols}{2} \begin{itemize} \item item 1 \item item 2 \item item 3 \item item 4 \item item 5 \item item 6 \end{itemize} \end{...


68

beamer provides the columns environment. Within it, you specify a column environment with a given width. Together, the following generic structure is used: \begin{columns}[<options>] \begin{column}{<width>} ... \end{column} ... \begin{column}{<width>} ... \end{column} \end{columns} It is best to specify the above <...


65

This is an old question, but I've run into the same problem, and all these solutions seemed too complex for my needs, namely in respect to horizontal padding. Looking for a rapid solution similar to the one proposed above for vertical padding (\arraystretch), I've found \setlength{tabcolsep} to be a good candidate. Applying it on the example, it would be: ...


57

I had similar problem and found out that it is enough to start the columns environment command by [T] options, \begin{columns}[T] Works fine for me.


42

One simple way is to use the array environment together the expansible brackets \left[ and \right] (note the use of {*{20}c} as suggested by @cmhughes): \left[ \begin{array}{*{20}c} 1 & 0 & 0 & 0 & 0 & 1 & 0 & 0 & 1 & 0 & 1 & 0 & 0 & 0 & 0 & 1 & 0 & 0 & 1 & 0 \end{array} \right] ...


37

p means normal cells, they are like parbox with alignment at the top line b means alignment at the bottom, so the baseline is at the bottom line m means alignment in the vertical center, i.e. the baseline is in the center. So the position for alignment is meant. In your picture, the top line of the first text, the middle of the second and the bottom line of ...


33

Needed to say (an that's something the other answers miss a bit), && is nothing more and nothing less then & <no code here> &, i.e., it is just two tab column alignment points &s in a row. It's not like dollars, where $ $ and $$ is an important difference: & & and && behave exactly the same way.


30

Vertical padding There is one drawback using \arraystretch: the content of the cell is no more vertically centred, and for each table you have to determine the optimal value of \arraystretch. Another solution, not mentioned in the above link, is given by the cellspace package that ensures an adjustable minimal distance between the top of a row and the above ...


30

The array package documentation, on pages 2 and 3 has the explanations: Additional explanation To answer your specific question: \newcolumntype{Y}{>{\small\raggedright\arraybackslash}X} defines a new type of column called Y based on a X column (this column type is defined by the tabularx package and it is basically a p{ <width>} column, where &...


29

See section 12.7 (Splitting a Frame into Multiple Columns) of the beamer manual: t will cause the first lines of the columns to be aligned. Default if global option t is used. T is similar to the t option, but T aligns the tops of the first lines while t aligns the so-called baselines of the first lines. If strange things seem to happen in ...


28

Try adding a \vrule between the two columns: \begin{columns}[c] \begin{column}{0.5\textwidth} \includegraphics<1>[width=0.35\textwidth]{picture.jpg} \end{column} \hspace{-50pt} \vrule{} \begin{column}{0.50\textwidth} \includegraphics<1>[width=0.35\textwidth]{picture.jpg} \end{column} \end{columns}


26

One way to do this is to collect the whole columns content e.g. using the environ package, which stores the environment body in \BODY. Redefine column to measure the natural height of each column as well as remembering the maximum height in a first pass and then typeset the columns in a second pass where a \vspace is inserted with the correct adjustment. I ...


25

The usual way to resume lists is to use the enumitem package, but this doesn't work very well with beamer. So in this case, the easiest way to do this is to define a counter to store the enumeration number in the one column and restore it at the beginning of the enumeration in the next column: \documentclass{beamer} \newcounter{savedenum} \newcommand*{\...


24

If you want to optically align a figure with a displayed list you may need manual tweaking, for example \vspace*{-1cm} just after \begin{figure} would move it up.


23

In general, & is the cell separator in tabulars and similar constructions. TeX computes the column widths dynamically, although it's possible to fix a column width. A double & has no special meaning: a single & means “go to the next cell of the alignment”, so && means “the next cell is empty, go to the following one”. A generic tabular ...


22

If you need to adjust the spacing for just one table you could also add/remove some space before the table and restore previous value after it: \addtolength{\tabcolsep}{-1pt} \begin{tabular}{cc} text & text \end{tabular} \addtolength{\tabcolsep}{1pt}


22

The tabularx might also be useful to you. From the documentation A new environment, tabularx, is defined, which takes the same arguments as tabular*, but modifies the widths of certain columns, rather than the inter column space, to set a table with the requested total width. Below is a MWE- note that the different width specifications, 250pt and \...


21

It's generally not a good idea to reduce the font size to make things fit in your document. Font sizes should be uniform for equivalent parts of a document. However, it's certainly easy enough to do if that's what you need. The array package adds some very useful functionality to the regular tabular mechanism. In particular it allows you to specify code ...


19

Update This known bug was solved some time ago. There is no need for workaround solutions or including special lines of code in preambles. \documentclass{beamer} \begin{document} \begin{frame}[t]{Test Columns} \begin{columns} \column{.5\linewidth} First Column \begin{itemize} \item First Item First Item First Item First Item \item Second Item Second Item ...


19

Maybe you can give the tasks package (used to be part of the exsheets bundle) a try: \documentclass{article} \usepackage[T1]{fontenc} \usepackage[utf8]{inputenc} \usepackage{multicol} \usepackage{tasks}[2013/04/07] % renew the {tasks} environment to use bold labels % and use two columns as default settings: \RenewTasks[counter-format= tsk.,label-format=\...


18

You can use the option keepspaces. For more details have a look at the documentation. \documentclass{article} \usepackage{listings} \lstset{literate=*{+}{*}{1}, columns=fullflexible,keepspaces} \begin{document} \noindent \begin{tabular}{ll} flexible & \lstinline[columns=flexible]!1 + 1!\\ spaceflexible & \lstinline[columns=spaceflexible]!1 + 1!\\ ...


18

You may be looking for something like the following, which requires loading the tabularx package: \noindent % needed if the tabularx environment isn't encased in a table environment \begin{tabularx}{\textwidth}{|*{4}{X|}} ... \end{tabularx} In the title of your posting, you mention you want a solution using columns of type p{<some width>}. The X ...


18

The columns environment can take quite a few optional arguments, one of which is totalwidth which I have specified as \linewidth in the solution below. Here's the output I've borrowed Stefan's solution from Changing default width of blocks in beamer to define a varwidth block which allows you to specify the width of a block environment. It does lead to ...


Only top voted, non community-wiki answers of a minimum length are eligible