New answers tagged

2

The material in the tabularx emvironment features a formatting inconsistency: In the NS1 row, each parenthesis-delimited group of numbers (a) does not contain whitespace inside the group and (b) is followed by , ("comma-space"). This is not the case, for some reason, in the NS2 row. I suggest modifying the NS2 row so that its input is formatted the same way ...


1

The issue is that the text in the problematic row is all in one big math-mode block, and automatic line-breaks cannot be inserted inside a single math-mode block. If you want to pick where it's allowed to insert a line-break yourself, you can just insert an extra closing $ there, followed by a whitespace, followed by a new $ to start the new math-mode block. ...


0

You can use \multicolumn{...}{...} anywhere, not just in the table headers. Use it to redefine the alignment of text locally.


3

With use of \adjustimage from the adjustbox package this is simple: \documentclass{article} \usepackage{longtable} \usepackage[export]{adjustbox} \begin{document} { \adjustboxset{width=\linewidth,valign=c, margin=0pt 3pt 0pt 3pt} \begin{longtable}[h]{|p{0.2\textwidth}|p{0.12\textwidth}|c|} \hline \adjustimage{}{example-image-duck} & \...


1

[H] assumes it comes between paragraphs. You shouldn't really ever need \newline or \noindent in a document, I would add \usepackage{parskip} so paragraph indention is zero and just use blank lines instead of \newline.


0

This happened to me a couple of times and I would usually use resizebox to get rid off it. I believe this is totally fine to do because the manuscript is just that---a manuscript; it is not the final publication. The typesetter will have to deal with the table anyway and will likely rearrange it. Instead of 10cm you could use \textwidth. I disagree with not ...


3

Use of \resizebox is very bad idea. With it you lost control on font size (in you case it is not readable. Beter is use smaller font, reduce width of \tabcolsep and write column header in two (or more) lines. Unfortunately it is unknown, what is contents of empty cells. I they are numbers you may consider to use S column type defined in the siunitx package. ...


0

I have found other solutions too. Just post here for future reference. \usetikzlibrary{calc,angles,quotes} \begin{document} \begin{tikzpicture} \tkzTabInit[lgt=1.5,espcl=3,deltacl=0.5] {$x$/.6, $f_{\alpha}'(x)$/.6, $f_{\alpha}(x)$/2.5} {$0$,$\alpha-1$,$x^*(\alpha)$,$+\infty$} \tkzTabLine{,+,z,-,-,-,} \draw ($(N12)!0.5!(N13)$) node (A){$0$} (N22) node[below] ...


6

I think plain TikZ is not so difficult as OP complained ^^ What does plain mean? SIMPLE! Change [yscale=.8,xscale=1.4] as you wish! \documentclass[tikz,border=5mm]{standalone} \begin{document} \begin{tikzpicture}[yscale=.8,xscale=1.4] \draw[shift={(-.5,.5)}] (0,0) rectangle +(8,-5) (0,-1)--+(0:8) (0,-2)--+(0:8) (1,0)--+(-90:5); \path (0,0) node{$x$} ...


3

As you've (re-)discovered, the threeparttable environment uses the width of the very first tabular-like environment to determine the width of the other two main elements -- the caption and the tablenotes environment. Because threeparttable expects to "see" just one tabular environment, it forces a line-break ahead of the second tabular environment in your ...


5

I used the intermediate tab value command from page 33 of the manual \tkzTabVal{2}{3}{0.5}{$x^*(\alpha)$}{0} the {2}{3} refers to the column precedent and antecedent and 0.5 on the sloped line -- -- a second negative/descent/derivative is provided with the help of intermediate entries-- these intermediate entries are not shown with a column heading of - ...


4

Enclose both four-column tables in an "outer", two-column tabular environment: \documentclass{article} \usepackage{multirow, threeparttable} \begin{document} \begin{table}[hbtp] \begin{threeparttable} \caption{Participation Rates by Demographic Group} \label{participation_rates} \centering \footnotesize \begin{tabular}{cc} % <-- new \begin{tabular}{cccc}...


0

The times I needed to do that what I did was to export to CSV and mangle the result with some Perl scripting (a few lines do most of the job). Required touchups on the column headings and lines, however.


0

You may be interested in a general solution to the problem, working in or outside tables. \documentclass{article} \usepackage{xparse} \ExplSyntaxOn \NewDocumentCommand{\managecsvlist} { O{} % pre code m % main code O{} % post code m % list } { #1 \clist_set:Nn \l__kunkel_list_clist { #4 } \clist_use:Nn \l__kunkel_list_clist { #2 } #3 }...


3

You have misunderstood the use of multirow. You have to span the number of "normal" rows because multirow does not know the height of the spanning box, see page 6 in the manual and the example given there: The middle column is the \multirow. You would expect it to be vertically centered, but it isn’t. This is because \multirow doesn’t know the height ...


0

Another way is to define the table contents with docsvlist first in a separate command outside of tabular and then insert it. Found that useful to assemble a table with contents from same-named variables read from multiple files \newcommand*{\DataSetList}{DataFile1,DataFile2} \renewcommand{\do}[1]{\input{DataSet.tex} Data1 & Data2 & Data3 \\} % ...


5

Don't use \resizebox, with it you loose control on the font size. Fonts can become to small that can be read. The table generated by your MWE is (without use of \resizebox) wider than is text width. To remedy this you can select one of the following possibilities: make \textwidth wider, for example with use of the \geometry package reduce font and \tabcol ...


4

To complement a bit Mico's answer (+1): Your document is implicitly set in \flushbottom style—for reasons explained by Mico. This means that when TeX choses a page break, it will stretch the material gathered for the page so that it spans over the full height of the page body. This way, all pages normally have the same height (that is, unless under ...


4

If the article document class is loaded with the option twoside, the directive \flushbottom is activated. This directive tells LaTeX to make sure that the bottom edges of each pages of text are placed just above the bottom margins. That's what you're experiencing. I can think of two remedies: Don't specify the option twoside. If you must set the twoside ...


0

Another option is to let \endminipage redefine the rule. This does affect all minipages of course but I deem this to be the typical use case anyway. \documentclass[a4paper,12pt]{book} \usepackage{booktabs} \usepackage[hang,flushmargin]{footmisc} \let\oldendminipage\endminipage \def\endminipage{\let\footnoterule\relax\oldendminipage} \begin{document} \...


1

With help of adjustbox and use of enumerate list from the enumitem package: \documentclass{article} \usepackage[table, svgnames]{xcolor} \usepackage{enumitem} \usepackage{adjustbox} \usepackage{lipsum} % for generating dummy text filler \begin{document} \begingroup \setlist[enumerate]{label=\alph*), labelsep=1em} \setlength{\arrayrulewidth}{1pt} \...


1

After cleaning-up your code, I obtain the following result: (red lines indicate text border) \documentclass{article} \usepackage[skip=1ex, labelfont=bf,font=small]{caption} % <--- new %---------------- show page layout. don't use in a real document! \usepackage{showframe} \renewcommand\ShowFrameLinethickness{0.15pt} \renewcommand*\...


2

You can use simply \colorbox{your color}{your table} MWE: \documentclass{article} \usepackage{booktabs,xcolor} \begin{document} \begin{table} \caption{Foo}\centering \colorbox{green!20}{\begin{tabular}{cc} foo & baz\\ \midrule 11 & 12 \\ 13 & 14 \\ \end{tabular}} \end{table} \end{document} It could look better with some settings before of ...


0

If you use LuaLaTeX, the following could work. As you can see, \sortnames is no longer necessary. Moreover, the name list cleans itself with each print and you only need the first \hline (although you can include it into the Lua macro if you want) %!TEX program = lualatex \documentclass[]{scrbook} \usepackage{luacode} \usepackage{geometry} \usepackage{...


2

The following MWE based on tcolorbox might serve as a starting point: \documentclass{article} \usepackage[most]{tcolorbox} \usepackage{booktabs} \newtcolorbox[blend into=tables]{mytable}[2][]{float=htb, halign=center, title={#2}, ...


4

To answer the first question, an immediate hack is shown below. Medium-term solution would be to enhance OSCOLA's regex processing when constructing the index sort key (contact the maintainer). Long-term solution for easier maintenance would be, possibly, to separate out the components of the case number molecule into its atoms as separate fields: then ...


3

Your MWE has many issues: you haven't defined content of maketitle (in your case it is not relevant, so remove it from MWE) you did not load packages booktabs and makcell for tables you did not load package siunitx for use of S columns \begin{tabula}{\columnwidth}{@{\extracolsep{\fill}} l *{4}{S} } is wrong, correct is \begin{tabular*}{\columnwidth}{@{\...


2

I will summarize the simple solutions in this answer and write a Matlab-integrated in the sequence. Do LaTeX in Excel: Slow, difficult, high manual effort, susceptible to many errors, can be reusable but need copy and paste every time. This method you just built the LaTeX by typing the pieces you need inside Excel. That's was the first idea I ever had. It ...


0

I propose to do that with tabularx, using the syntax >{\hsize=coeff\hsize}X, where the coefficients are proportional to 20, 30,25 and 25 respectively, with the constraint is that the sum of the coefficients be equal to the number of X columns (4): \documentclass{article} \usepackage[utf8]{inputenc} \usepackage{booktabs} \usepackage{tabularx} \usepackage[...


0

The x coordinate can be specified with the syntax x expr=\coordindex, which means that the row index of the table is used as x value. Optionally you can specify col sep=space to make sure pgfplots understands the column separator in the data file. MWE: \documentclass{article} \usepackage{pgfplots} \pgfplotsset{compat=1.11} \begin{document} \begin{...


0

This issue was due to the Overleaf project using TeX Live 2016, at which time, the vertical alignment functionality was not present in \multirow. With the project changed to use TL2019, changes had to be made to the template I was using. A similar question (that I didn't see previously) was posted here and @LianTzeLim posted a solution here.


1

\documentclass{article} \usepackage[utf8]{inputenc} \usepackage{booktabs} %---------------- show page layout. don't use in a real document! \usepackage{showframe} \renewcommand\ShowFrameLinethickness{0.15pt} \renewcommand*\ShowFrameColor{\color{red}} %---------------------------------------------------------------% \begin{document} \begin{table}[hb] %Label ...


0

You can do this using the caption package and by redefining the label format using the \DeclareCaptionLabelFormat command. In this #1 will get replaced with the name of the float (table, figure, ...) and #2 will be replace with the reference number. The default label format is simple #1 #2. In your case you want the number before the name and prefixed with ...


0

Is this what you are looking for -- the solution has been given by @DavidCarlisle -- https://tex.stackexchange.com/a/107566/197451 \documentclass{article} \usepackage{color} \makeatletter \let\xx@begindocumenthook\@begindocumenthook \let\xxhline\hline \let\xx@xhline\@xhline \usepackage{colortbl} \let\hline\xxhline \let\@xhline\xx@xhline \let\@...


2

A small variation of @MadyYuvi answer (+1), without use of the adjustbox package, used are makecell and caption packages: \documentclass{book} \usepackage[skip=1ex, labelfont=bf]{caption} \usepackage{array, makecell} \begin{document} \begin{table}[ht] \centering \setcellgapes{2pt} \makegapedcells \begin{minipage}[t]{0.4\textwidth} \centering \caption{$...


2

One solution with tabulary: \documentclass{article} \let\bf\bfseries \usepackage{array,geometry,tabulary,booktabs,lipsum,microtype} \begin{document} \renewcommand\arraystretch{2} \begin{tabulary}{\linewidth}{>{\bf}l*3{>{\parskip1em}L}}\toprule Klasse & \bf FooFooFoo & \bf FooFoo & \bf FooFooFoo \\\midrule Niv\.a 1 & \lipsum[1][1-...


2

Welcome to tex.se! Obviously this a very open question. Some decisions about the design certainly don't have a blanket solution and have to be reassessed depending on the content of the table and the goal you are trying to achieve with it: Do you want centered text? Rules or spaces separating rows or columns? Should the cells be somehow otherwise ...


1

Below code may helps you: \documentclass{book} \usepackage{adjustbox} \begin{document} \begin{table} \adjustbox{valign=t}{% \begin{minipage}[t]{0.35\textwidth} \caption{q =3} \begin{tabular}[t]{l|l|l|r} \hline n & 1 & 2 & 3 \\ \hline $\chi_1(n)$ & 1 & 1 & 0\\ $\chi_2(n)$ & 1 & -1 & 0\\ \end{tabular}...


4

tabularx allows you to have a column "as wide as possible". \documentclass{article} \usepackage{tabularx} \usepackage{booktabs} \begin{document} \begin{table}[!h]\label{Table} \caption{random symmetrized instances.} \begin{tabularx}{\textwidth}{c>{\centering}Xc} \toprule Name & The generators of the symmetry group & Dimension \\ ...


3

I wouldn't recommend using @-commands in the document body anyway. If you plan to use \@@input, add \makeatletter \newcommand{\tableinput}[1]{\@@input #1 } \makeatother to your document preamble and use \tableinput{file} in the document. Beware that this will create spurious spaces in other contexts.


1

I would just use a matrix. As long as you do not draw the nodes at the corners, you will respect the rounded corners of the matrix node. For your convenience I added a shortcut n which suppresses the draw. \documentclass[tikz,border=3mm]{standalone} \usetikzlibrary{matrix} \begin{document} \begin{tikzpicture}[n/.style={draw=none},font=\sffamily] \path node[...


5

With latin, the character ^ is a shorthand, so it is different in the preamble than in the body of the document. Shorthands used to be activated as soon as the language is loaded, not any longer. You have three strategies: transfer \newcolumntype{^}{>{\currentrowstyle}} after \begin{document} use the cryptic code \begingroup\lccode`~=`^\lowercase{\...


5

gloss-latin makes the ^ active at begin document. This means the tabular doesn't recognize it as a defined columntype anymore. If you activate the shorthand it works again: \documentclass{book} \usepackage{fontspec} \setmainfont{Times New Roman} \usepackage{polyglossia} \setdefaultlanguage[variant=british]{english} \setotherlanguage{latin} \...


2

Just for fun in my free time. I hope OP would provide a MME in the next question (if any) ^^ \documentclass[border=3mm]{standalone} \usepackage{tikz} \begin{document} \begin{tikzpicture}[scale=.75,font=\sffamily] \begin{scope}[shift={(-.5,.5)}] \clip[draw,rounded corners] (-4,-3) rectangle (5,2); \fill[cyan] (-4,-1) rectangle +(1,1); \fill[magenta] (3,0) ...


1

Or like this? This solution assumes that both \rowcolor instructions should really be \cellcolor instructions. Observe that I've deliberately omitted all vertical and horizontal rules, as they don't provide anything but visual clutter. \documentclass{article} \usepackage[table,svgnames]{xcolor} \usepackage{tabularx,amssymb,bm} \newcolumntype{a}{>{\...


2

Like this? \columncolor is intended for coloring of columns \rowcolor can be only at beginning of a row, not in the middle; \rowcolor over-rides columncolor \cellcolor is intended for coloring one cell, it over-rides \rowcolor and column color \documentclass{article} \usepackage[table, svgnames]{xcolor} \usepackage{tabularx} \usepackage{pifont} \...


1

Just for fun, here's a solution which builds on @zarko's fine answer. IMNSHO, the table that the OP wishes to replicate somehow in LaTeX contains a lot of near-redundant information. Worse still, three of the six data columns do little except create visual clutter; simply omitting these three columns seems like a worthwhile idea. The resulting table, ...


2

One problem per question please! In following answer deal only with table issues. In your code fragment you use longtable. It is intended for tables longer than one page. Does your table is such? Lets consider that this is the case ... \documentclass{article} \usepackage{booktabs, longtable, makecell} \renewcommand\theadfont{\small\bfseries} \renewcommand\...


1

To simply make your code compilable, you will need the following 4 packages: longtable, setspace, array and booktabs. You will also have to add an \\ right after the \label command. In the following example, I have also removed the center environment since longtables are automatically centered given they fit into the textwidth. You can also replace the \...


1

Maybe you like the following tweaks to your table: Since you did not provide any information about your document layout, I defined my own, as follows: text margin is defined to be 25mm (with use of the geometry package) used article document class and babel package with french option for units and columns with numbers only is used siunitx package multi ...


Top 50 recent answers are included