Hot answers tagged

13

I suspected that your question How do I use the ampersand (&) inside a foreach or conditional (or other group/environment) when building tables? was of the XY type. The usual problem in these cases is that you cannot build a table inside a \foreach statement, because table cells form groups. The strategy is to build the table body beforehand. ...


6

You need to keep the colour restore within the noalign so need {} but colortbl allows you to colour \hline, so do you need this? \documentclass{article} \usepackage{color, colortbl} \begin{document} \begin{tabular}{l} x \\ \noalign{{\color{red}\hrule height 1pt}} \rowcolor{blue} x \end{tabular} \end{document}


5

The problem is the ampersand character &. Edit your CSV file to replace all instances of & by \& or by the text string and solves the problem. The ampersand is a special character to delineate fields in tabular and array environments. To access it you need to escape it. The csvsimple package doesn't do any sanity checks on your csv data: it ...


5

Here is one way of doing it, using the graphicx package: \documentclass[10pt,letterpaper]{article} \usepackage{graphicx} \begin{document} \begin{table}[] \centering \caption{My caption} \label{my-label} \begin{tabular}{|l|l|l|l|l|l|l|} \hline \multicolumn{1}{|c|}{CONCEPT} & \multicolumn{6}{c|}% {COMPREHENSIVE ...


4

LaTeX provides a p{length} specifier for this purpose. With array.sty, you can reduce the amount of repeated code by defining a new column specifier: \documentclass{scrartcl} \usepackage{fontspec} % for the Swedish chars \usepackage{array,booktabs,ragged2e} \newcolumntype{N}[1]{>{\hspace{0pt}\RaggedRight\itshape}p{#1\textwidth}} \begin{document} ...


4

With tikz \documentclass[a4paper]{article} \usepackage{tikz} \newcommand{\tikzmark}[2][]{\tikz[remember picture, overlay]\node[#1,inner sep=0pt,xshift=-\tabcolsep](#2){};\ignorespaces} \newcommand{\tm}[2][]{\tikzmark[yshift=#1]{#2}} \begin{document} \begin{table}[] \centering \caption{My caption} \label{my-label} \begin{tabular}{|l|l|l|l|l|l|l|} \hline ...


4

You can do it with \csvautotabular, provided you change the category code of & before reading the file. \begin{filecontents*}{\jobname.csv} CategoryName,Pageviews Restaurants,37951 Shopping,22002 Things to do,20067 Nightlife,10612 Gifts,9194 Food Shopping,8655 Useful Stuff,8536 Parenting ,8353 Home,7654 Fitness,6623 Event & Party Planning,6387 ...


4

Using \internallinenumbers seems to work code \documentclass{scrartcl} \usepackage{blindtext} \usepackage{lineno} \linenumbers \usepackage{longtable} \begin{document} \blindtext \begin{longtable}{|p{0.7\textwidth}|p{0.3\textwidth}|}\hline \begin{minipage}{\linewidth} \internallinenumbers \blindtext \end{minipage} & This is a test This is a test ...


4

Like this? \documentclass{article} \usepackage{graphicx} \begin{document} \begin{tabular}{llll} (A) & (B) & (C) & (D) \\ \includegraphics[width=.2\linewidth]{example-image} & \includegraphics[width=.2\linewidth]{example-image} & \includegraphics[width=.2\linewidth]{example-image} & ...


4

The \dbend glyph has no depth, but it extends far below the baseline nonetheless. Look at the first line in the example below, with the correction with \raisebox. \documentclass{article} \usepackage{manfnt} \usepackage{array} \newcommand{\dnote}[1]{% \begin{tabular}{@{}m{0.13\textwidth}@{}m{0.87\textwidth}@{}} \raisebox{1.475\height}{\huge\dbend} & ...


3

Material in a column of type c does not get line-broken automatically. Thus, even though you've set \textwidth as the first argument of the tabular* environment, there's no guarantee that the combined width of the four columns won't, in fact, exceed \textwidth. That's what's happening in your code. Instead of using a tabular* environment, I suggest you use ...


3

For horizontal centering, use the c ("center") column type instead of the l ("left-align") column type. Vertical centering may be achieved in a number of ways. Since the table appears to contain mostly numbers, I suggest you provide the instruction \setlength\extrarowheight{2.5pt} immediately after \begin{table}. By the way, "vertical centering" has both ...


3

like this? \documentclass{beamer} \usepackage{booktabs} \usepackage{colortbl} \begin{document} \begin{frame} \frametitle{Example} \begin{table} \centering \begin{tabular}{c c c} \toprule H1 & H2 & H3\\ \midrule 1 & \only<2>{\cellcolor{blue!50}}? & 3 \\ 2 & 4 & ?\\ \bottomrule \end{tabular} \end{table} \end{frame} ...


3

Here is a solution \documentclass{article} \usepackage{lipsum} \newcommand*\editorialtable{% \beforeeditorialtable \begin{tabular}{|l|l|l|l|} \hline \multicolumn{1}{|c}{Section} & \multicolumn{1}{|c}{Subsection} & \multicolumn{1}{|c}{Responsible}&\multicolumn{1}{|c|}{Helpers}\\ \hline \makeeditorialtable \end{tabular} \aftereditorialtable} ...


3

One easy way to do is to use \parbox{} to limit the header width. You can give the size for each parbox as shown below. Another change I would suggest is to use \ding{51} and \ding{55} instead of \textsurd and x. they can be found in pifont package. In Lyx you can use the insert Tex code facility to insert just the {\parbox{2cm}{Header}} inside the table ...


3

Just replace in the main table preamble c with @{}c@{} for each column which contains a nested tabular. Note this requires the array package. I also improved the table loading the cellspace package, which defines minimal vertical padding between a row and the above and below cells in columns with a specifier prefixed by the letter S: ...


3

Something like this: For this you need to elininate table column separation in column in which you nested table. This is done with use of @{}: \begin{table} \centering \begin{tabular}{ |c|@{}c@{}| }% <-- aded @{} \hline no test & no test \\ \hline no test & \begin{tabular}{c|c} D1 & 1.23 \\ \hline D2 & 1.23 \\ \end{tabular} \\ ...


3

looks like a bug but as usual with these things, an extra {} helps \documentclass[11pt]{article} \usepackage{listings} \usepackage{matlab-prettifier} \lstdefinestyle{matlab}{style=Matlab-editor, basicstyle=\ttfamily\normalsize, escapechar = `, mlshowsectionrules = true, frame=none } \begin{document} \begin{tabular}{p{0.5\textwidth} } ...


2

I propose a solution with tabularx. I also added (automatically) some vertical padding between rows, with the cellspace package: \documentclass[11pt]{scrartcl} \usepackage{fontspec} % for the Swedish chars \usepackage{polyglossia} \setmainlanguage{swedish} \usepackage{fontspec} % for the Swedish chars \setmainfont{Minion Pro} ...


2

You can use \only. For example: 1 & \only<1>{?}\only<2>{somethingelse} & 3 The parameter in <> specify when it will be displayed. You can also use ranges: \only<1-3>{abc}: Display abc for the first 3 steps \only<2->{abc}: Display nothing on the first step, then display abc for each following step


2

You should look into using a longtable environment, as is done in the following modified (and simplified/shortened) version of your code. \documentclass[12pt,a4paper]{article} \usepackage[T1]{fontenc} \usepackage[utf8]{inputenc} \usepackage[brazilian]{babel} \usepackage{longtable} % <---- new \usepackage[justification=centering]{caption} ...


2

See the updated and better version at the end, please! A preliminary version with expl3 features and key-value interface, only working for a table at the end at the moment! \documentclass{article} \usepackage{xparse} \usepackage{xkeyval} \makeatletter \let\latex@@section\section \let\latex@@subsection\subsection \define@key{editorial}{helper}{% ...


2

Basic option would be my_rows.tex with \rowdef{row_complex}{\arow{this}{is}{a}{nastyyyy}{$\mathcal{C}$ row}} \rowdef{row_real}{\arow{this}{is}{a}{less nasty}{$\mathcal{R}$ow}} Then adding in the preamble \newcommand*\arow[3]{#1&#2&#3\tabularnewline} \newcommand*\rowdef[1]{\expandafter\def\csname row@#1\endcsname} \newcommand*\rowuse[1]{\csname ...


2

I am no expert in pgfplotstable but here is an idea to build upon. To get the entries to align prettier, see Q131081. (I find pgfplotstable overly complicated and it surely doesn't help that the manual repeats parts of the PGFmanual …) Code \documentclass{article} \usepackage{booktabs,pgfplotstable} \pgfmathsetseed{\number\pdfrandomseed} ...


2

You can use the sideways environmentand reduce the fontsize for this table, or reduce the value ofarraycolsep`: \documentclass{article} \usepackage[showframe]{geometry} \usepackage{rotating, array} \usepackage{caption} \begin{document} \begin{sidewaystable} \setlength\tabcolsep{4pt} \renewcommand\arraystretch{1.4} \centering \caption{A table with ...


2

Here's the way to do to it with array and \newcolumntype. \documentclass{article} \usepackage{array} \newcolumntype{R}[1]{>{\raggedleft\arraybackslash}p{#1}} \newcolumntype{L}[1]{>{\raggedright\arraybackslash}p{#1}} \begin{document} \begin{table} \small \centering \begin{tabular}{L{3cm}|l|l|R{5cm}} A & B & C & D ...


1

Changing the column-type to p instead of m for the text seems to fix this. Some clever person can probably answer as to why. \documentclass{standalone} \usepackage{manfnt} \usepackage{array} \newcommand{\dnote}[1]{\begin{tabular}{@{}m{0.13\textwidth}@{}p{0.87\textwidth}@{}}\huge\dbend & {#1}\end{tabular}} \begin{document} \dnote{How much quacks would ...


1

Very close to @Mico's solution. I kept the centred first three columns if you like themm, added some vertical padding between row with \extrarowheight , to differentiate rows from lines in multiline cells, and corrected some typos/missing accents: \documentclass[a4paper]{article} \usepackage[utf8]{inputenc} \usepackage[T1]{fontenc} ...


1

Using Geometry, noindent and scripts \documentclass{article} \usepackage[utf8]{inputenc} \usepackage[T1]{fontenc} \usepackage{lmodern} \usepackage[frenchb]{babel} \usepackage[margin={1cm,1cm}, paper=a4paper]{geometry} \begin{document} \noindent \scriptsize \begin{center} \begin{tabular}{|c|c|c|c|c|c|c|c|c|c|} Modes & LED Status & ...


1

This is more extended comment than answer: you show as only code snipped, which can not be compiled (see above comments) tablefootnote works only in table environment environment \begin{center}\centering ...\end{center} is strange the way of use \thead{} nullify the column type m{...} etc With MWE below I got the following result: ...



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