Tag Info

New answers tagged

0

I come back in this thread to ask something really related. I need to compile the following code, representing a table, quite similar the one you made. But something doesn't work with the last column, I think. \begin{table}[h!] \begin{tabularx}{\textwidth}{|l|*{20}{>{\arraybackslash}X|}} \multicolumn{1}{c}{}& ...


0

Here it is. I need the threeparttable package for table notes, makecell to allow for line breaks in tabular cells and a better spacing between rows. The code is more compact: \documentclass{article} \usepackage{makecell, booktabs, caption} \captionsetup{labelfont = sc} \renewcommand \cellalign{tc} \setcellgapes{3pt} \makegapedcells \usepackage{siunitx} ...


1

I'm not sure I'd recommend it but I think you are asking for \begin{table}[htbp] \renewcommand\arraystretch{.8} which makes the table take less vertical space. Unreleated but for numeric columns it's more normal to use r rather than c so the digits line up, or use one of the numeric alignment columns from dcolumn or siunitx packages.


0

Thanks to Aditya I found the following more satisfying solution, using new table commands: % setup for the table \startsetups table:grondrente \setupTABLE[each][each][width=0.11\textwidth, align={middle,lohi}] \setupTABLE[each][each][frame=off, leftframe=on, rightframe=on] \setupTABLE[row][1,2][background=color,backgroundcolor=gray] ...


0

Here is one approach, using a p column (from the array package) of the specified width (8 cm) to replace your \parbox and \multirow construction. The rest of the cells to the side are placed in a nested tabular aligned to the [t]op, with the spacing around the outer column zeroed for consistent spacing through the table. Your question wasn't entirely clear ...


1

I'm not sure which table generator you're using, but always having the \resizeboxes is a really bad idea. As you've noticed, you get inconsistent font sizes and distorted rules. You might want to check if there is an option to turn this off in whichever software/web app/etc. you're using for this. The immediate fix is to comment out the \resizebox line and ...


1

As David wrote in his comment, listings is mainly for verbatim contents. If you have this much markup in an "escape to LaTeX" within a listing, you're doing something wrong. You're essentially hardcoding the output of the shell command cal 8 1973 into your lstlisting environment. Embedding it into a tabular within an escape to LaTeX seems convoluted and ...


3

You can also use Natural Tables for such tables as it provides a much cleaner separation of content and presentation. \startsetups table:formatting \setupTABLE[each][each][width=0.1\textwidth, align={middle,lohi}] \setupTABLE[each][each][frame=off, leftframe=on, rightframe=on] \setupTABLE[row][1,2][frame=on] \setupTABLE[row][2][align={middle,low}] ...


0

To my test is more appropriate for explanation of variables of some equation to use list environment than table. For example something as follows: \documentclass{article} \usepackage{amsmath,amsfonts,amssymb} \usepackage{siunitx} \newcommand{\mathentrylabel}[1]{% \makebox[\labelwidth][l]{\parbox[t]{\labelwidth}{% ...


1

This is one solution where tikzmark taking 2 arguments, brace decoration and link macro that takes 3 arguments are used. Code \documentclass[border=30pt]{standalone} \usepackage{tikz,array,calc} \usetikzlibrary{decorations.pathreplacing} \newcommand\tikzmark[2]{% \tikz[remember picture,overlay] \node[inner sep=0pt,outer sep=2pt] (#1){#2};% } ...


3

You add no meaning with the units in brackets; in my opinion it's even wrong, as usually brackets denote abstract dimensions, such as “length·time–1” or “force·length”. The s column type is what you're looking for. I also removed all \: spacing commands, which are wrong, and set “eff” in upright type. Note also that Where:\bigskip would allow a page break ...


5

This can be done with the help of the collcell package (loads array). Just define your column as \newcolumntype{U}{>{$[\collectcell\si} l <{\endcollectcell]$}} and you're done. MWE \documentclass[10pt,a4paper]{report} \usepackage[utf8]{inputenc} \usepackage{amsmath} \usepackage{amsfonts} \usepackage{amssymb} \usepackage{graphicx} ...


5

Please unlearn your habit of using \left ... \right all over Drop the [], they do nothing to the interpretation of that column use the s column, and in that column just write say \meter In code \documentclass[10pt,a4paper]{report} \usepackage[utf8]{inputenc} \usepackage{amsmath} \usepackage{amsfonts} \usepackage{amssymb} \usepackage{graphicx} ...


0

I see now where I made a mistake, I added \vtop{\phantom{x} \vfill .. } to the header elements, if I delete that code, and the unnecessary ~ before each header, the table looks just fine. \starttext ...


3

Two other solutions: one with the blkarray package, the other with the rcases environment, from mathtools: \documentclass[112pt]{book} \usepackage[utf8]{inputenc} \usepackage[showframe, nomarginpar, textwidth = 15cm]{geometry} \usepackage{mathtools} \usepackage{blkarray} \usepackage{nccmath} \DeclareMathOperator\sech{sech} \DeclareMathOperator\csch{csch} ...


1

I have a solution now that implements a push pop system, pushing footnotes into a token list within the tabular (and any other) environment and spawning them after the end. The basic idea was inspired from cacamailg's answer in the post: Footnote in tabu table not shown My solution provides a \Mymakesavenoteenv command which works similar to ...


1

The solution I now found (using the code provided by Wolfgang Schuster) looks like this, which is almost ok. code: \startuseMPgraphic{accolade} z1 = (-233,0) ; z2 = (-220,22) ; z3 = (-155,211) ; z4 = (-200,690) ; z5 = (-142,1033) ; z6 = (-97,1106) ; z7 = (-71,1125) ; z8 = (-61,1104) ; z9 = (-80,1077) ; z10 = (-108,1002) ; z11 = (-129,666) ; z12 = ...


3

Just for variety, here's a solution that uses the drcases environment of the mathtools package. \documentclass{article} \usepackage{mathtools} \DeclareMathOperator\sech{sech} \begin{document} \begin{align*} \begin{drcases} \sin \leftrightarrow \tanh\\ \cos \leftrightarrow \sec \end{drcases} &\quad \sin^2 x + \cos^2 x = 1; \quad \tanh^2 x + \sech^2 x = ...


7

\documentclass{article} \usepackage{amsmath} \begin{document} \[ \begin{gathered} \left.\begin{array}{c@{\,\,}c@{\,\,}c} \sin&\leftrightarrow&\tanh\\ \cos&\leftrightarrow&\sec \end{array} \right\} \sin^2 x + \cos^2 x = 1 \\ %% second line \left.\begin{array}{c@{\,\,}c@{\,\,}c} \sin&\leftrightarrow&\tanh\\ ...


3

Use m column type from array package instead of p type.. \documentclass[12pt]{article} \usepackage{array} \newlength{\mylen} \settowidth{\mylen}{the title} \begin{document} \begin{tabular}{|l|c|} \hline the title & number \\ \hline \multicolumn{1}{|m{\mylen}|}{very very very very long} & 100 \\ \hline \end{tabular} \end{document} As explained ...


1

Another attempt for long column case. Use of widthof{<content>} from calc package is needed. Code \documentclass[border=20pt]{standalone} \usepackage{array,calc} \begin{document} \noindent \begin{tabular}{|p{\widthof{the title}}|} \hline the title \\ \hline very very very very long \\ \hline very very very very very very long \\ \hline ...


1

You can use the multirow package for this, but only after you know how many lines your long entry will take, because you have to tell multirow how many lines it should span for vertical centering. \documentclass[12pt]{article} \newlength{\mylen} \settowidth{\mylen}{the title} \usepackage{multirow} \begin{document} \begin{tabular}{|l|c|} \hline the title ...


2

Like this? \documentclass[12pt]{article} \newlength{\mylen} \settowidth{\mylen}{the title} \begin{document} \begin{tabular}{|l|} \hline the title \\ \hline \multicolumn{1}{|p{\mylen}|}{very very very very long} \\ \hline \end{tabular} \end{document} If you don't want those underfull boxes, load array package and use ...


2

You can add \multicolumn{1}{l}{} in the second line. \documentclass[12pt]{article} \begin{document} \begin{tabular}{|l|} \hline line 1\\ \hline \multicolumn{1}{l}{}\\ \hline line 3 \\ \hline \end{tabular} \end{document} You can also use a \fbox (provided the contents all have same width). \documentclass[12pt]{article} \begin{document} ...


1

I would suggest using a graphical package such as metapost or tikz to draw such diagram. Tikz probably already has a nice interface for this. Here is a barebones examples of how to draw such tables in metapost. \useMPlibrary[fen] % To get BasicBraceSymbol \defineframed [quantity] [ align=middle, width=0.25\textwidth, frame=off, ...


0

As Thomas said, it is much easier to use "Natural Tables". For simple tables, you can still use the old table syntax. Here is an example: \definecolor[lightblue][r=0.8,g=0.8,b=1] \definecolor[lightred][r=1,g=0.8,b=0.8] \startsetups table:color \setupTABLE[row][2][background=color, backgroundcolor=lightblue] \setupTABLE[column][2][background=color, ...


5

Another attempt. Without the text, I can't really be sure the layout adjustments I've made make much sense, but here goes anyway: \documentclass{article} \usepackage{booktabs,siunitx,tabularx} \begin{document} \begin{table} \small\setlength{\tabcolsep}{3.7pt} \begin{tabularx}{\textwidth}% ...


4

I suggest you proceed as follows: The column type of the second column may as well be set to c to minimize its width For the remaining seven columns, a ratio of widths of roughly 3:2 seems about right. Setting the \hsize of the left-most column to 1.3 and that of the other six to 0.95 (note: 1.3 + 6*0.95 = 7) may be a good starting point. Feel free to ...


4

How about that? I suppressed all vertical rules, loaded booktabs and cellspace for a better vertical spacing between rows. I also used siunitxfor numbers alignment and makecell, which allows for line breaks and a common formatting of column heads. %%%%%%%%%% \documentclass{article} \usepackage[utf8]{inputenc} \usepackage{geometry} \usepackage{fourier} ...


2

How to scale/resize a table/tabular inside a minipage This question is the first one to pop up when searching for: latex scale table in minipage. Likewise queries such as rescale table in minipage or resize table in minipage end up at this answer too. I was personally also searching for this and couldn't find an answer anywhere. However, I've found the ...


1

I suggest you use minipages instead of a multicol environment. \documentclass[a4paper]{article} \usepackage[english]{babel} \usepackage[utf8]{inputenc} \usepackage{listings} \begin{document} \parindent0pt \newtheorem{prob}{Problem} \setcounter{prob}{3} \begin{prob} Write a python function $sumsq$ that takes as input a positive integer $n$ and returns ...


0

Short answer: yes ;-) Here is my suggestion for a complete solution. It does not use the predefined tabular options, but inserts the tabular environment settings directly: \documentclass{article} \usepackage{filecontents} \usepackage{csvsimple} \begin{filecontents*}{mylist.csv} name,job,age John,student,21 Frederik,student,18 Johnson,professor,49 ...


1

Something likes this. Basically use of \tikzmark and \link skill defined in the macros. Also, thanks to @AboAmmar for the `shorten >=xx pt' suggestion. \newcommand\tikzmark[2]{% \tikz[remember picture,overlay] \node[inner sep=0pt,outer sep=2pt] (#1){#2};% } \newcommand\link[2]{% \begin{tikzpicture}[remember picture, overlay, >=stealth, shorten >= ...


1

Eledmac knows this problem. That's why it provides an edtabularl environnement (§ 13 of the actual handbook). However, for some technical reason, the \let\footnote\footnoteC can't work in this case (see https://github.com/maieul/ledmac/issues/207#issuecomment-54959471 for more details), and you have to do something like def\footnote#1{\footnoteT{#1}}. So ...


3

Here is a solution, using the \Xhline and \Xcline commands from makecell: \documentclass[a4paper]{article} \usepackage{array} \usepackage{makecell} \renewcommand\cellalign{lc} \setcellgapes{3pt} \makegapedcells \newcommand\thickvrule[1][2pt]{\vrule width #1} \begin{document} \begin{table}[htp] ...


4

You can get the vertical alignment with m in the middle column \begin{tabular}{|>{\centering\arraybackslash}m{2cm}| >{\centering\arraybackslash}m{8cm}| >{\centering\arraybackslash}m{3cm}|} but the table is too wide for article a4 text width Overfull \hbox (47.48578pt too wide) in paragraph at lines 7--16 ...


5

You can use the makecell package for that: it allows for linebreaks and common formatting in certain cells, with the \makecell and \thead commands: \documentclass[a4paper]{article} \usepackage{array} \usepackage{makecell} \renewcommand\cellalign{lc} \setcellgapes{3pt} \makegapedcells \begin{document} \begin{table}[htp] \begin{tabular}{|*{5}{l|}} \hline ...


6

pbox doesn't seem to help you much here, I'd just use tabular \documentclass[a4paper]{article} \usepackage{array} \setlength\extrarowheight{2pt} \begin{document} \newcommand\pb[1]{% \begin{tabular}{@{}l@{}}#1\end{tabular}} \begin{table}[htp] \begin{tabular}{|l|l|l|l|l|} \hline \multicolumn{2}{|l|}{SOME TEXT HERE} & \multicolumn{3}{l|}{Big ...


3

afterpage doesn't support twocolumn (I never thought anyone was going to use it at all:-) and making it do so would be quite a bit of work. If you use \onecolumn at the point where latex would have broken the text page had there been no table, you can then add the longtable in 1-column mode, then issue \twocolumn and resume the text. This is more hand ...


4

If you insist, here is again a two column table as it makes good alignment. \documentclass{article} \usepackage{xtab,booktabs,array} \usepackage[textheight=10cm]{geometry} %% just for this example. \begin{document} %\topcaption{This is top caption} %\bottomcaption{This is bottom caption} %\tablecaption{this is table caption} \tablefirsthead{ ...


1

Here's one possibility: \documentclass{article} \usepackage[margin=3cm]{geometry} % set margins smaller (YMMV) \usepackage{lmodern} % for unicode support \usepackage{booktabs} % for publication-quality tables \usepackage{tabularx} % for column width balancing \usepackage{siunitx} % for typesetting physical quantities with units \sisetup{% setup for your ...


3

A tick label can contain anything that's allowed inside a Tikz node, with the caveat that if it contains comma(s), it must be protected with curly braces. Use xticklabels={\begin{tabular}{r}1\\2\\3\end{tabular},B,C}, in the axis options. The ,B,C is required because if one tick label text is manually specified, all of them need to be manually specified. ...


0

My answer is to used {p} in \begin{tabular} to left-justify the text: \documentclass[11pt]{report} \usepackage{amsmath,array} \newcolumntype{C}[1]{>{\centering\arraybackslash}m{#1}} \begin{document} \begin{table}[] \caption{Comparisons of different PVT systems, presented in 2014.} \begin{center} \begin{tabular}{|C{1cm}|p{6cm}|C{3cm}|C{3cm}|} %\hline % ...


5

You need to make the table narrower than the text width, also as latex warns: LaTeX Warning: Unused global option(s): [paper=a4]. The document class option syntax was wrong. \documentclass[a4paper]{article} % A4 paper and 11pt font size \usepackage[dutch]{babel} % Dutch language/hyphenation \usepackage{array} ...


4

I think it's easier to define a new column type C \newcolumntype{C}{>{\hspace{-\tabcolsep}}c} and use it instead of c to obtain what you want, so you don't have to manually specify the spacing. MWE \documentclass[11pt,onecolumn]{article} \usepackage{array} \usepackage{color, colortbl} \definecolor{mColor1}{rgb}{0.9,0.9,0.9} \begin{document} ...


5

It's easier to set \tabcolsep to zero then add space where you need it, this has some space in the outer columns, and tight space in the middle \documentclass[11pt,onecolumn]{article} \usepackage{array} \usepackage{color, colortbl} \definecolor{mColor1}{rgb}{0.9,0.9,0.9} \begin{document} \newcolumntype{N}{@{}>{\columncolor{red}[0pt][0pt]}m{0pt}@{}} ...


0

You can do that most easily with the makecell package, which allows for linebreaks and a common formatting in cells, with the \thead and \makecell commands: \documentclass{article} \usepackage{makecell, booktabs, mathtools} \setcellgapes{4pt} \makegapedcells \begin{document} \begin{table} \centering \begin{tabular}{c p{3cm}} \toprule \textbf{Equation} ...


2

You can use a tabular inside a tabular \documentclass{article} \newcommand{\mysplit}[1]{% \begin{tabular}[t]{@{}c@{}} %% remove [t] if you need vertical centered things. #1 \end{tabular} } \begin{document} \begin{table}[htb] \centering \begin{tabular}{| c | p{3cm} |} \hline \textbf{Equation} & \textbf{Description} \\ \hline ...


4

To highlight just one entry, you need (should) not use that complex macro. Just use this simple version: \newcommand\Mark[2][]{% \tikz[baseline=(a.base)]{ \node[inner sep=0pt,outer sep=0pt](a){\phantom{#2}}; %% just to be defensive \node[draw,red,thick,inner sep=1pt, ellipse,text=black,overlay,minimum width=\widthof{#2},#1] {#2};% } } Remember to load ...


7

When a p (or m) cell is started, \everypar is not void, but it contains \vrule\@height\ht\@arstrutbox\@width\z@\everypar{} which is the code that provides the insertion of a strut at the beginning of the paragraph. With your code you're removing this. \documentclass{article} \usepackage{array} \newcommand{\dohang}{\hangindent1em\hangafter1 } ...



Top 50 recent answers are included