Hot answers tagged

6

A couple of ad hoc commands: \documentclass{article} \usepackage{amsmath,tabularx} \begin{document} \begin{table}[h!] \caption{Table}\label{tab:1} \centering \newcolumntype{C}{>{\centering\arraybackslash}X} \newcommand{\makebiggermath}[1]{% \sbox0{$\displaystyle#1$}% \makeheight{\dimexpr\ht0+\dp0+10pt}% \box0 } \newcommand{\makeheight}[1]{% \...


4

You almost achieve what you like to have :-) \documentclass[a4paper]{report} \usepackage{multirow} \usepackage{array} \begin{document} \begin{table}[h] \centering \renewcommand{\arraystretch}{2} \begin{tabular}{|m{2cm}|m{2cm}|m{3cm}|m{2cm}|m{2cm}|} \hline \multirow{2}*{text} & \multirow{2}*{text} & \multirow{2}*{text} & \multicolumn{2}{c|}{text}\...


4

\documentclass{article} \usepackage{multirow} \begin{document} \begin{center} \renewcommand{\arraystretch}{1.2} \begin{tabular}{|c|c|c|c|} \hline \multicolumn{2}{|c|}{} & \multicolumn{2}{c|}{Player 1} \\ \cline{3-4} \multicolumn{2}{|c|}{} & $\alpha$ & $\beta$ \\ \...


4

\multicolumn{3}{c|}{Player 1} to add the line to the right and \multicolumn{1}{c}{} in the previous cell to remove the one on the left.


4

Boldline, and the bold lines from makecell have problems with colour in tables. For lines of variable widths, you can load booktabs and neutralise locally the padding added around the rules, or use the \specialrule command, which lets you set the width, padding above and padding below: \documentclass[12pt]{article} \usepackage{longtable} \usepackage[table]{...


4

The reason for the misalignment is the & between \cline{2-4} & \cline{4-6}. Moreover, don't put \\ after a \hline, and you don't need an empty row to create a gap between the lines. However, the look of your table could be improved using booktabs package and its rules. You have a lot of empty space, I used makecell to put the headers into more ...


4

One option is to use a tikz matrix of nodes. it is possible to use fairly intuitive syntax so that you can produce something like: using code like: \documentclass[a4paper]{article} \usepackage[dvipsnames,table]{xcolor} % »table« optons loads »colortbl« package \usepackage{tikz} \usetikzlibrary{matrix} \parindent=0pt \begin{document} \begin{...


4

with array: \documentclass{article} \usepackage{lipsum} \begin{document} \lipsum[22] \[\renewcommand\arraystretch{1.5} \begin{array}{r|rrrr} &3 &-5 &0 &4 \\ 2 & &6 &2 &4 \\ \cline{1-5} &3 &1 &2 &\multicolumn{1}{|c}{}8 \\ \cline{5-5} \end{array} \] \lipsum[33] \end{document}


4

You need to restore the colour in the same cell, so: \documentclass{article} \usepackage{xcolor} \makeatletter \def\clineThicknessColor#1#2#3{\@ClineThicknessColor#1\@nil{#2}{#3}} % Example usage: \clineThicknessColor{2-3}{1.5pt}{blue} \def\@ClineThicknessColor#1-#2\@nil#3#4{% \omit \@multicnt#1% \advance\@multispan\m@ne \ifnum\@multicnt=\...


4

I'm wondering why you are using \multicolumn, a solution for the Theoratical / Application part might be: \documentclass{article} \usepackage{amsmath,tabularx} \begin{document} \begin{table}[h!] \caption{Table}\label{tab:1} \centering \newcolumntype{C}{>{\centering\arraybackslash}X} \begin{tabularx}{\linewidth}{ l | @{}C@{} |}%\hline \cline{2-2} &$...


4

One possibility is to draw an invisible line (of zero width) and the desired height and depth (below the baseline). For example \rule[-4mm]{0mm}{10mm} draws a line of zero width (therefore invisible) of 10 mm height and 4mm depth. The command \renewcommand{\arraystretch}{1.5} allows to modify the spacing between the text of a cell and its border. With ...


4

I have two MWEs: the last one cure both problems, the first does not cure the small green spaces. Using hhline You have forgotten to turn on arrayrowcolor{black} two places. In addition, the hhline- syntax was wrong one place. I have not found a solution for the small spaces in the horizontal borders (yet). It is the green coloured arrayrule under the ...


3

I see no reason for using the equationarray environment. You can obtain what you want with a plain array \documentclass[12pt,a4paper]{article} \begin{document} \[ \renewcommand*{\arraystretch}{1.5} \begin{array}{c|cccc} &3 &-5 &0 &4 \\ 2 & &6 &2 &4 \\ \cline{1-5} &3 &1 &2 &\multicolumn{1}{...


3

The problem with \cline and coloured cells is known. A work-around consists in using \hhline which works well with colour: set the colour of the last part of the hhline to yellow, and restore it to black afterwards. \documentclass{book} \usepackage{colortbl,multirow, hhline} \begin{document} \chapter{Sample title} \section{Head one First} Between 200BC ...


3

There's no interaction with the vertical lines if you locally remove the padding of booktabs rules, which depend on the values of \aboverulesep (default: 0.605mm or 0.4ex) and \belowrulesep{<width>} (default: 0.984mm or 0.65ex) : \documentclass[11pt]{article} \usepackage{lmodern} \usepackage{blkarray, bigstrut} \usepackage{booktabs} \begin{document} ...


3

Do you want this? \documentclass{beamer} \usepackage{amsmath} \begin{document} \setbeamertemplate{navigation symbols}{} \begin{frame}[shrink] \begin{alignat*}{5} \uncover<+->{t_n &= a + (n-1)d \\} \uncover<+->{t_3 &= a + (3-1)d \tag{1} \\\cline{1-1}} \uncover<+->{t_3 &= a + (3-1)d \\} \uncover<+->{t_3 &...


3

You seem to be using a dummy column in order to separate the two parts: you need to specify it in the argument to \begin{tabular}. \documentclass{article} \begin{document} \begin{tabular}{lccccc c ccccc} \hline & \multicolumn{5}{c}{Females} && \multicolumn{5}{c}{Males} \\ \cline{2-6} \cline{8-12} Treatment & V1 & V2 & V3 &...


3

Here is a hack, playing with the optional argument of \\ and the overhang values of \rowcolor: \documentclass[a4paper,twocolumn]{article} \usepackage[margin=1in]{geometry} \usepackage{multirow,booktabs} \usepackage{amssymb} \usepackage[table]{xcolor} \usepackage{booktabs, makecell} \newcommand{\myrowcolor}[1]{\rowcolor{#1}[\tabcolsep][\dimexpr\tabcolsep+0....


3

As @leandris has kindly suggested in a comment, to make sure that the horizontal line shows up fully, it suffices to (a) load the hhline package and (b) replace the \cline{3-6} directive in question with \hhline{~~----}. In addition, you may want to simplify your code considerably. For instance, by employing an array environment instead of a tabular ...


3

Put a \multicolumn{1}{c}{} as the first cell to have a cell without the vertical line. I've used \cline{2-5} \multicolumn{1}{c}{}\\[-10pt]\hline to avoid a double horizontal line below the first empty cell. As Zarko pointed out, \parboxes are not needed. \documentclass{article} \usepackage{multirow} \usepackage{rotating} \begin{document} \begin{table}[...


3

First, of you will make it a lot easier for others to help if you provide a full minimal example instead of a sniplet, then we do not have to guess the rest. Secondly, don't just ignore compilation errors. I get the following error ! Misplaced \omit. \@cline #1-#2\@nil ->\omit \@multicnt #1\advance \@multispan \m@ne \ifnum \@....


3

The \thead machinery seems like overkill for the table at hand. In its place, I suggest use \multicolumn{2}{c}{...} directives for the centered header cells, along with \cmidrule instead of \cline. I would also recommend aligning the numbers on their respective decimal markers and typesetting them in math mode, so that typographically appropriate math-minus ...


2

I am also unable to reproduce the error message you say you're getting. At any rate, I'd like to suggest that get rid of the \cline instruction and modify your table to give it a much more open look, by (a) getting rid of all vertical lines, (b) getting rid of most of the horizontal lines generated by \hline, and (c) using the macros \toprule, \midrule, and \...


2

This is because you're using \cline{x-y}\\ instead of just \cline{x-y}. The horizontal line specifications (\hline, \cline or otherwise) are specified at the beginning of every line. Therefore, including an ending \\ in their construction issues another empty line in the tabular.


2

See example. Also, use \hline for horizontal lines that span the tabular. \documentclass{article} \usepackage{lipsum} \begin{document} \begin{tabular}{p{1.5in}cp{1in}cp{1.5in}} \cline{2-3} \lipsum[1] & 1 & \lipsum[2] & 2 & \lipsum[3] \\ \cline{3-5} \end{tabular} \end{document}


2

I created \byx{<eq1>}{<eq2>}{<via>}{<eq-sum>}, which can be nested. \documentclass[11pt]{report} \usepackage{amsmath,stackengine} \newcommand\byx[4]{% \setbox0=\hbox{$~#1\qquad#2~$}% \setbox2=\hbox{~by #3}% \Shortstack[c]{\copy0 \rule[2.3pt]{\wd0}{.5pt}\rlap{\copy2} $#4$}% \hspace{\wd2}% } \begin{document} \[ \byx{% \...


2

The problem comes a misunderstanding of >{\hsize=0.6\hsize}X: it is made for X columns of unequal lengths and the values work as barycentric coordinates: their sum must be equal to the number of columns (4, here). Their sum is equal to 2.4 instead! As all your columns have equal widths, remove this specification and it will be fine: \documentclass[12pt]...


2

You can have what you want incorporating cline{2-4} to \endhead. I suppose you inserted some empty rows to give vertical padding to cell contents. I made padding it automatic. Also I used the (redefined) X column type to make the table full width. \documentclass[11pt]{article} \usepackage[utf8]{inputenc} \usepackage{booktabs} \usepackage{ltablex} \...


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