Use p{width} for your column specifiers instead of l/r/c.
\begin{tabular}{|p{1cm}|p{3cm}|}
This text will be wrapped & Some more text \\
\end{tabular}
EDIT: (based on the comments)
\begin{table}[ht]
\centering
\begin{tabular}{p{0.35\linewidth} | p{0.6\linewidth}}
Column 1 & Column2 \\ \hline
This text will be wrapped & Some more text \\
Some text here & This text maybe wrapped here if its tooooo long \\
\end{tabular}
\caption{Caption}
\label{tab:my_label}
\end{table}
we get:
Taking Norman’s advice to heart, I’ve hacked together a solution that used (a patched) Pygments for highlighting and pushed in as many features as possible without bursting ;-)
I’ve also created a LateX package, once my Pygments patch was released in version 1.2 …
Presenting minted
minted is a package that uses Pygments to provide top-notch syntax highlighting in LaTeX. For example, it allows the following output.
Here’s a minimal file to reproduce the above code (notice that including Unicode characters might require XeTeX)!
\documentclass[a4paper]{article}
\usepackage{fontspec}
\usepackage{minted}
\setsansfont{Calibri}
\setmonofont{Consolas}
\begin{document}
\renewcommand{\theFancyVerbLine}{
\sffamily\textcolor[rgb]{0.5,0.5,0.5}{\scriptsize\arabic{FancyVerbLine}}}
\begin{minted}[mathescape,
linenos,
numbersep=5pt,
gobble=2,
frame=lines,
framesep=2mm]{csharp}
string title = "This is a Unicode π in the sky"
/*
Defined as $\pi=\lim_{n\to\infty}\frac{P_n}{d}$ where $P$ is the perimeter
of an $n$-sided regular polygon circumscribing a
circle of diameter $d$.
*/
const double pi = 3.1415926535
\end{minted}
\end{document}
This can be typeset using the following command:
xelatex -shell-escape test.tex
(But minted also works with latex
and pdflatex
…)
minted.sty
works similar to texments.sty
but allows additional features.
How to get it
Once again, thanks to Norman for motivating me to produce this package.
Best Answer
\include
always uses\clearpage
, a not entirely sensible default. It is intended for entire chapters, not for subsections (why would you want subsections in separate files, anyway?).You can fix it either by using
\input{filename}
or loading thenewclude
package and writing\include*{filename}
instead.