Tag Info

New answers tagged

0

I suggest you refrain from using the m specifier in your table. How do you like a layout like this? Also note that you specify six columns in your table head. \documentclass[a4paper,twoside,12pt]{book} \usepackage[T1]{fontenc} \usepackage[utf8]{inputenc} \usepackage[english]{babel} \usepackage{booktabs, array, tabularx} \usepackage{lmodern, ...


2

This is a version which will work with 'any' column title, writing a fake label into .aux and referring to it with \nameref*. If the column title is just pure A, etc. another, counter-based approach would be better! \documentclass{article} \usepackage{tabularx} \usepackage{multirow} \newcommand{\columnheaddisplaystyle}[1]{% \textbf{#1}% } ...


4

Your table is actually fairly complex, so I'm not sure it's straightforward to come up with a "least complex way" to typeset it. To reduce the table's complexity, and in recognition of the fact that one column ("Speed") is common to both the "R=1" and "R=5" parts, I would reduce the total number of columns from 6 to 5. To improve the table's readability, I ...


2

Possibly something like this but you should look at siunitx, too for columns of figures. \documentclass{article} \usepackage{booktabs,array} \begin{document} \begin{tabular}{ccccccc} \toprule \multicolumn{3}{c}{R=1} && \multicolumn{3}{c}{R=2}\\\cmidrule{1-3}\cmidrule{5-7} Speed & Time Delay & Distance && Speed & Time Delay ...


1

This is used explicitly from JPi's solution above, so I don't expect neither upvotes nor downvotes. Regarding the vertical spacings/alignment, Bernards solution is better than mine of course. \documentclass{article} \usepackage{array} \newcolumntype{C}[1]{>{\centering\arraybackslash}p{#1}} \begin{document} \begin{center} ...


5

You can use the makecell package: it allows for linebreaks in cells. Here is solution that uses tabularx to fit text width: \documentclass[a4paper]{article} \usepackage[utf8]{inputenc} \usepackage[T2A ,T1]{fontenc} \usepackage[russian]{babel} \usepackage[showframe, nomarginpar]{geometry} \usepackage{fourier, erewhon} \usepackage{array, tabularx,multirow, ...


4

Is this what you like to obtain: \documentclass[11pt, border=1mm, preview]{standalone} \usepackage[many]{tcolorbox} \begin{document} \begin{table} \caption{A table with rounded corners} \centering \tcbox[left=0mm,right=0mm,top=0mm,bottom=0mm,boxsep=0mm, boxrule=0.4pt, colback=white]% set to your wish ...


2

In the following code, I define a tabenumerate environment and a \tabitem command, which mimick a 2nd level enumerate environment within a tabular environment: \documentclass{article} \usepackage{amsmath,amssymb} \usepackage{eqparbox} \newcounter{tabenum} \newenvironment{tabenumerate}{% \setcounter{tabenum}{0}\setlength\extrarowheight{\itemsep} ...


4

Here are two possible ways, without align etc. if it must be an enumerate version. The reason, why the columns are not aligned from one item to the next is, that each \begin{tabular}{ll}...\end{tabular} has different column widths. If all would columns would have the same width, then the columns would be aligned. I've done this in the second version below, ...


3

Like this? \documentclass{article} \begin{document} \begin{center} \begin{tabular}{|p{1in}|p{1in}|p{1in}|p{1in}|c|} \hline Hello & a very long sentence $T$ & a very long sentence $U$ & \multicolumn{2}{|c|}{a very long sentence} \\ \cline{4-5} & & & $h_T$ & $h_U$ \\ \hline I'm afraid I don't speak ...


3

A variant, also with makecell and siunitx, and booktabs and caption: \documentclass{acm_proc_article-sp} \usepackage{lipsum} \usepackage{multirow, tabularx, caption, booktabs} \usepackage{makecell} \renewcommand\cellalign{rc} \usepackage{siunitx} \sisetup{table-format=1.1} \begin{document} \lipsum[2]% \begin{table}[! htbp]\captionsetup{font=bf} ...


2

Problem is construction of your table. Since you didn't provide MWE, I use one from some old picture ... anyway, obtained table is 80 mm wide. This should fit in one column. Try code below in your document and see, if this is what you looking for. \documentclass[11pt, border=1mm, preview]{standalone} \usepackage{makecell} ...


3

Here's a solution that preserves the use of tabularx. It uses S[table-format[5.0] as the main column type for columns 2 and 3 of the tabularx environment. In addition, it uses \multicolumn{1}{C}{...} directives for the header cells -- where C is a centered version of the X column type that comes with the tabularx package -- in order to let LaTeX figure out ...


0

There are some conceptual problems with the code you've posted: Nesting sideways, landscape, and sidewaysfigure environments is bound to give you grief. A single sidewaysfigure environment suffices. You're trying to set up a tabular environment whose total width grossly exceeds the width of the (rotated) textblock. (For instance, 0.45*3=1.35>>1 -- and ...


0

I can't tell you exactly what is wrong without a proper example which can be compiled to reproduce the problem. I experimented, but failed to reproduce the issue you described. Even after completing your code to create a minimal document, I got errors: \multirow{}{}{} requires 3 arguments - not 1 nobody can compile a document which requires files they do ...


2

The threeparttablex is done for that: bringing the functionalities of threeparttable to longtable. It defines a ThreePartTable and a TableNotes environments. The latter must be declared at the beginning of the ThreePartTable environment, before longtable. It is inserted with an \insertTableNotes command, wherever you want.The tablenotes can be referred to. ...


1

\documentclass[a4paper,oneside,abstracton]{scrartcl} \usepackage[utf8]{inputenc} \usepackage[T1]{fontenc} \usepackage{lmodern} \usepackage[english]{babel} \usepackage{threeparttable} \usepackage{longtable} \usepackage[a4paper,bottom=3.1cm]{geometry} \usepackage{booktabs} \begin{document} %\begin{table}[!htb] %\centering %\tiny \small % ...


11

The schemata package is designed to handle simple and complex schemas of just this kind. If you are not using mathematical content, one advantage of this approach is that it is primarily designed for typesetting textual schemas. (Though no doubt you could use it with mathematical content if you wished.) For example: \documentclass{article} ...


5

An alternate process might be to use the amsmath cases environment. \documentclass[12pt]{article} \usepackage{amsmath} \begin{document} $\text{main} \begin{cases} \text{Case a} \begin{cases} \text{case 1} \\ \text{case 2} \end{cases} \\ \text{Case B} \begin{cases} \text{case 1} \\ \text{case 2} \end{cases} \end{cases}$ \end{document} which yields the ...


5

The following might be a start for you: \documentclass{article} \usepackage{array} \begin{document} \begin{center} \begin{tabular}{ m{5em} @{} m{11em} } Main $\left\{\rule{0pt}{\dimexpr2\normalbaselineskip+.5\bigskipamount}\right.$ & \begin{tabular}{@{}l@{}} $\mbox{Option A }\left\{\begin{tabular}{@{~}l@{}} Option ...


1

Only with reducing text size a little (\small) and reasonably shrinking space between columns (\renewcommand{\tabcolsep}{4pt}), both changes are relatively unnoticeable. \documentclass[12pt]{report} \usepackage{threeparttable,booktabs,multirow,lscape} \usepackage[letterpaper,margin=1in]{geometry} \begin{document} \renewcommand{\tabcolsep}{4pt} ...


2

You can try something like this (all horizontal and vertical rules only for explanation and can be removed): \documentclass{article} \usepackage{array,tabularx} \begin{document} \newcolumntype{R}[1]{>{\raggedleft\arraybackslash}p{#1}} \newcolumntype{N}{>{\centering\arraybackslash}X} \begin{tabularx}{\linewidth}{|R{5cm}|N|m{5cm}|} \hline Lorem ipsum ...


6

Is that what you want? I played with the (lr) argument for \cmidrule, and required a (negative, here) trim on the right, calculated from the column width, which is known thanks to the minipage. If not known, we would have to use the eqparbox package. \documentclass{article} \usepackage{booktabs} \begin{document} \begin{tabular}{@{}ll@{}} XXXXXXX & ...


4

A rule with an arbitrary length can be specified with \rule{length}{width}, however, this would be placed in the table cell. To spread over the cells, use \noalign{\noindent\rule{7.75cm}{2pt}} (change the dimensions at will) (Thanks to @touhami for the hint with \noindent) \noalign prevents the aligning in cells, all content is then basically set as if no ...


3

This code works. I took the opportunity to improve your table: I don't think you really need a tabularx environment, so I replaced the Y column with a plain l. I also made column head two lined when I thought it necessary, with the makecell package: \documentclass[fontsize=10pt, paper=letter, headings=small, bibliography=totoc, DIV=9, headsepline=true, ...


2

Would this example work for you? \begin{tabular}{|c|c|c|c|} \hline a&b&c&d\\\hline 1&2&3&4\\ 5&6&7&8\\\hline \end{tabular} vs. \begin{tabular}{|c|c|c|c|} \hline\multicolumn{1}{|c}{a}&\multicolumn{1}{c}{b}& \multicolumn{1}{c}{c}&\multicolumn{1}{c|}{d}\\\hline 1&2&3&4\\ ...


3

Just to show the application of \multicolumn. \documentclass{article} \begin{document} \begin{tabular}{|*{6}{c|}*{3}{l|}} \hline \multicolumn{1}{c}{1} & \multicolumn{1}{c}{2} & \multicolumn{1}{c}{3} & \multicolumn{1}{c}{4} & \multicolumn{1}{c}{5} & \multicolumn{1}{c}{6} & 7 & 8 & 9 \tabularnewline \hline Vector Indicator ...


4

\documentclass{article} \begin{document} \sffamily \begin{tabular}{|l|l|} \hline Sample header & Sample header \\ \hline\hline Key & Value \\ Key 2 & Value 2\\ \hline \end{tabular} \end{document} Since you didn't give any column specifications, I wrote a simple tabular.


0

Just worth adding to @Herbert's answer, that you can also make an entire column bold with >{\bfseries}, used in exactly the same way as he uses >{\em}. The meaning of bfseries is discussed in detail here. As stated in the comments here, you can use \normalfont{} to unbold the column header. \begin{table} \begin{tabular}{>{\bfseries}l l} ...


1

This is a 'dirty' trick: Write \newlabel explicitly to the .aux file with a prefix for a new label, say stored:: and use \nameref* from hyperref to get the label content. The {}{} and {} arguments can be empty here, as they are not important for this approach. However, expansion will be an issue. If the caption content itself holds commands that are ...


1

I suggest using the makecell package. It allows for a common formatting in column heads and line breaks in cells. Also your table will look better without vertical lines. The booktabs package defines horizontal rules with variable thickness and some vertical padding around these rules. I replaced the center environment (which adds vertical spacing around the ...


0

In this case, a simple left-aligned stack would do. I also add a vertical buffer above/below the stack to offset the horizontal lines more than the default. \documentclass{article} \usepackage{stackengine} \begin{document} \begin {table}[h] \begin{center} \begin{tabular}{|l|l|l|l|} \hline $i$ & Degree $\phi_i$ & $\cos(\phi_i)$ & ...


1

You can always put a tabular inside a tabular: \documentclass{article} \begin{document} \begin {table}[h] \begin{center} \begin{tabular}{|l|l|l|l|} \hline $i$ & Degree $\phi_i$ & $\cos(\phi_i)$ &\begin{tabular}{@{}l} Product of $\cos(\phi_i)$\\$ K=\prod K_i=\prod\cos(\phi_i)$ \end{tabular} \\ \end{tabular} ...


0

I assume, that in appendix (A) you like put only two tables, without any text. In this case I would instead float environments set them directly, something like this: \documentclass[a4paper,twoside]{book} \usepackage{graphicx} \usepackage{caption} \begin{document} aćsdoefjaćoew % this part enables my pdf viewer \clearpage %to show both ...


3

You have two options. You want your caption label in LTR (english). In this case simply use \caption{\rl{الگوریتم شماره دو}} MWE: \documentclass[a4paper,12pt]{report} \usepackage{xepersian} \settextfont[Scale=1.3]{B Nazanin} \begin{document} \begin{latin} \begin{table}[h!] \large \centering \begin{tabular}{|l|} \hline \textbf{Proximal ...


4

If you want to consider using a table environment, the tablefootnote package solves your problem: \documentclass[colorlinks]{article}% \usepackage{footnotebackref} \usepackage{tablefootnote} \begin{document} \mbox{}\vfill A first footnote\footnote{First} \begin{table}[htbp] \renewcommand\arraystretch{1.5} \begin{tabular}{|r|l|} \hline First ...


4

The \footnotemark does increase the value of the footnote counter, but this will get out of sync when \footnotetext is used. One has to reset the footnote counter after the tabular environment to the state before. This can be done either manually, but might become tedious, if the values change or it's done with a dummy counter, which holds the footnote ...


1

The \xyR macro requires an argument, the desired spacing between rows. Here's how you should use it, with also a simpler approach: if you follow \xymatrix with @R=<dimen>, the given length will be used as the space between rows; you can also use \xymatrix@R+<dimen> \xymatrix@R-<dimen> that respectively add or subtract the given length ...


3

This answer is similar in spirit to the one by @daleif. The difference is that I use the macro \RaggedRight (from the ragged2e package) instead of the basic \raggedright directive; the difference is that \RaggedRight permits hyphenation. I also use a \newcolumntype instruction to set up a new column type called "P" that sets in contents automatically in ...


3

Presumably because ~ is stretchable and your columns are attempting to to keep a straight right edge. Probably better to use \documentclass{beamer} \usepackage{booktabs,array}% http://ctan.org/pkg/booktabs \newcommand{\tabitem}{~~\llap{\textbullet}~~} \begin{document} \begin{frame}{Symbolic Math Toolbox} \begin{itemize} \item Don't do nasty calculations ...


3

use \newcommand\tabitem{\makebox[1em][r]{\textbullet~}}


1

You're almost there: You simply need to (i) declare the tabular environment to have four rather than just two columns and (ii) use \multicolumn}{4}{|c|}{...} for the first header, as it needs to span all four columns. \documentclass{article} \begin{document} \begin{tabular}{ |c|c|c|c| } \hline \multicolumn{4}{|c|}{Participation Factor Analysis} \\ \hline ...


-1

Turning @Bernhard's comment into an answer: By replacing \newline with \endgraf, the alignment got fixed.


2

I do not know this package ctable, but you can centre tables by putting them in a \begin{center}\end{center} or inside a floating table environment together with \centering. For centring inside the columns you have to use the c qualifier. Or you use the nice S column of siunitx. % arara: pdflatex \documentclass{article} \usepackage{booktabs} ...


0

With a \Centerstack of the stackengine package, you can just use a normal c column of tabular. In the MWE below, I additionally horizontally-align columns to the right, left, and center, using the optional argument of \Centerstack. \documentclass{article} \usepackage[usestackEOL]{stackengine} \setstackgap{L}{\normalbaselineskip} \begin{document} ...


0

You can use a m{width} column type from array package \documentclass{article} \usepackage{amsmath} \usepackage{array} \begin{document} \begin{tabular}{m{1cm}m{1cm}m{1cm}} \shortstack{1\\ 2\\3\\4} & \shortstack{1\\2} & \shortstack{1\\2\\3} \end{tabular} \end{document}


5

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, ...


3

Since you are using knitr, the simplest thing is to add \\ every tenth row using add.to.row parameter of print.xtable. This is a very rough code; in the general case you need also to check that MatrixData has more than 10 rows. \documentclass{article} \usepackage{longtable} \begin{document} \listoftables << label=LongTable, results='asis', echo ...


1

An easy, but manual solution, to this problem would be to reduce the value defined in \extrarowheight to 0.2cm and manually add an empty row of 1.1cm (1.1cm + 2 * 0.2cm = 1.5cm) above each row for which a top padding of 1.5cm is desired. This approach has some limitations however. Because there is a minimum height a table row can have by default (see Column ...


3

Just shift the | to the first \multicolumn like & A & \multicolumn{2}{c|}{B} & \multicolumn{2}{c}{C} \\ BTW, siunitx has nothing to do with this alignment. Place | carefully while using \multicolumn.



Top 50 recent answers are included