New answers tagged

0

The reason for this behaviour is that graphic files a laid on the base line of the row, hence they're bottom-aligned. To have them top-aligned with the row, use \raisebox{-\height}{\includegraphics[height=3.75cm]{03_Figures/05_fuzzy_distance_near.eps}} and similarly for all figures. To have them vertically centred, use \raisebox{-\height}{\...


0

For simple frames, you can use the framed environment: \documentclass[]{article} \usepackage[flushleft]{threeparttable} \usepackage{tabularx, booktabs} \usepackage{framed} \begin{document} \begin{threeparttable} \centering \begin{tabularx}{\textwidth}{*{3}{ >{\centering\arraybackslash}X}} \toprule Col1 & Col2 & Col3\tnote{1} \\ \addlinespace 1 ...


2

tcolorbox is your new friend. About the various ways to customise it, see its documentation. \documentclass[]{article} \usepackage[flushleft]{threeparttable} \usepackage{tabularx} \usepackage{tcolorbox} \begin{document} \begin{threeparttable} \centering \begin{tabularx}{\textwidth}{@{\extracolsep{0pt}} llc} \hline Col1 & Col2 & Col3\tnote{1} \\ ...


1

Your MWE has multiple problems. Two of them are already indicated in comments above, others are indicated in Mico's answer. Beside this, please in future make your MWE really minimal. Most of the loaded packages are unnecessary to reproduce your problem. After stripping them out and consider the suggestions in the comments, below is a MWE which shows four ...


2

It's not clear to me that a tabularx environment -- with its width set to \textwidth, presumably -- is optimal for the table at hand. An ordinary centered tabular environment should do fine. If you do wish to use a tabularx environment, be sure to (a) supply the desired width of the environment as one of the arguments and (b) to use (suitable variants of) ...


4

Beware that for resized X cells, the coefficients are like barycentric coordinates and their sum has to be equal to the columns number. Also, I managed horizontal rules meet vertical rules, and set all rules (vertical as well as horizontal rules but one) to have the width of \midrules, and I simplified your code. \documentclass[12pt]{article} \usepackage{...


2

Try \documentclass[12pt]{article} \usepackage{booktabs,tabularx} \renewcommand\tabularxcolumn[1]{m{#1}} \newcolumntype{Z}[0]{>{\centering\arraybackslash}X}% \newcolumntype{s}[0]{>{\hsize=.4\hsize}Z}% \newcolumntype{n}[0]{>{\hsize=.8\hsize}Z}% \begin{document} \begin{table} \begin{tabularx}{7cm}{s|Z|s|n} & really really really long ...


3

If you must walk on a tightrope then: \documentclass{scrlttr2} \usepackage{tabularx} \begin{document} \newcounter{x} \setcounter{x}{0} \newcommand\zz[1]{#1} \centering \begin{tabularx}{\linewidth}{c|X} \stepcounter{x} \ifnum\value{x}=20 \zz{it is & 20} \else \zz{it is & ...


3

A conditional cannot straddle two cells. However you can use \ifthenelse: \documentclass{article} \usepackage{tabularx} \usepackage{xifthen} \begin{document} \newcounter{x} %\setcounter{x}{0} \begin{tabular}{c|l} \stepcounter{x}% \ifthenelse{\value{x}=20}{it is & 20}{it is & not}\\ \setcounter{x}{20}% \ifthenelse{\value{x}=20}{it is & 20}{it ...


1

At first sight, you could have to possibilities to achieve what you want: You know the total width of your table and the number of columns: you can easily guess the width of each column, and thus create column with adequate fixed width; Or you give the total width of your table, and you let tabularx compute the width of each column ('cuz you know, all the ...


7

You have to add a # in every of your \newcolumntype definitions: \newcolumntype{L}[1]{>{\raggedright\arraybackslash}p{#1}} \newcolumntype{C}[1]{>{\centering\arraybackslash}p{#1}} \newcolumntype{R}[1]{>{\raggedleft\arraybackslash}p{#1}} \newcolumntype defines a macro with one argument, this argument(the column width) can be accessed by #1.


8

You have \newcolumntype{L}[1]{>{\raggedright\arraybackslash}p{1}} You meant \newcolumntype{L}[1]{>{\raggedright\arraybackslash}p{#1}} as it is it always uses 1 as the width and complains about no unit.


3

Here is the solution with makecell: this package defines two main commands, which allow for line breaks and a common formatting of their contents, \makecell and thead. I also loaded caption, for a decent vertical spacing between caption and table, and changed the font size of the document to 12 pt (13pt doesn't exist for standard classes). \documentclass[...


5

In this instance you can just set the contents in that cell using a [t]op-aligned tabular: \documentclass{book} \usepackage{tabularx,booktabs} \begin{document} \begin{table} \centering \caption{Table of Variables} \begin{tabularx}{\textwidth}{ c >{\raggedright\arraybackslash}X } \toprule \textbf{Variables} & \textbf{Description:} \\...


2

The result is not very nice, but you can try with a TiKZ matrix. Be careful, a matrix doesn't behave like a tabular, so drawing vertical and horizontal divisions is not so easy. \documentclass[tikz,border=2mm]{standalone} \usetikzlibrary{positioning,matrix, decorations.pathmorphing} \begin{document} \begin{tikzpicture}[decoration={random steps, segment ...


1

In my experience, readers truly dislike having to crane their necks in order to read rotated material -- especially if it's just a line or two that's rotated. For the table at hand, it doesn't appear to be necessary to rotate the string "Summary of the monthly returns for the portfolios". Typesetting it as a normal, i.e., non-rotated header seems just fine. ...


2

If you want to hyphenate the centered text use: \usepackage{ragged2e} [...] \gmc{4}{@{}p{0.8\textwidth}@{}}{\Centering Summary of monthly cross-portfolio regressions: 25 Fama-French portfolios (constructed on 5 size and 5 book-to-market portfolios, including dividends)} and without hyphenated text use \centering instead of \Centering


2

Actually, ltablex doesn't work exactly like tabularx: the calculated size of the X columns is a maximum width for this column, its actual width depending on its actual content. If you don't want it, us the \keepXColumns directive. However, I would rather load siunitx and use the the S column type, to get a correct alignment of numerical values on the ...


2

In addition to changing the column type of the first header row (from l to -- in your answer -- >{\hsize=\textwidth}X, you should also avoid producing unsightly overlaps in the Region1/Region2/etc headers that risk making the headers unreadable; and find a way to avoid having the main tabular material in \footnotesize. In the code below, simplifying the ...


0

I changed the required line to \gmc{14}{>{\hsize=\textwidth}X}{Characteristic 1: Cross-sectional overlap in month-over-month regional real estate price changes (Spearman/Pearson correlations below/above the diagonal)} \\\hline and it works!!


4

You appear to be mixing up various concepts and methods from longtable, tabularx, tabular*, and still additional environments. Disentangling the mixture to figure out why the column contents aren't centered is rather difficult. I would like to suggest that you simplify the code by using just one environment -- and the commands that are appropriate for it. ...


3

It looks like a simple spelling mistake. The error message from the question contains a misspelled tabularx: ! LaTeX Error: File `tablularx.sty' not found. tablularx ⇒ tabularx After correcting the package name in the source, the error message should go away.


1

Here is a simpler code to do it, replacing the multirow environment with the \makecell command for the two middle columns, which allows line breaks in cells. I also load threeparttable for table notes: \documentclass[a4paper, 11pt]{scrreprt} \usepackage[utf8]{inputenc} \usepackage[T1]{fontenc} \usepackage{lmodern} \usepackage{ragged2e} \usepackage{tabularx,...


0

As I mentioned in my comment, simpolest solution is insert empty lines in third column cels, where the number of line in multri row cell is bigger: \documentclass[a4paper, 11pt]{scrreprt} \usepackage{booktabs,multirow,tabularx} \usepackage{ragged2e}% for smart ragged align in last column \def\tabularxcolumn#1{m{#1}} %vertical alignment center for ...


1

use \leavevmode\color so the paragraph starts before the colour, or perhaps better if you do not want line breaking in that first column use c not C for the first column.


2

You need to increase the widths of the 2-column headers adjust the relative widths of the X-type columns so that no line wrapping is required in the final two columns. In the code below, observe that the relative widths of the four L columns sums to 4 (the number of such columns), and that the relative widths of the two C columns also sums to 4. \...


1

I'd get rid of all \vskip and \hskip instructions and simply use a two-column tabularx environment. By the way, bold-facing is much more effective if it's used sparingly. \documentclass[12pt,twoside]{book} \usepackage[a4paper, margin=2.5cm, bindingoffset=6mm]{geometry} \usepackage{tabularx,booktabs} \begin{document} \begin{table} \begin{tabularx}{...


2

\begin{table}[!htb] \centering \begin{tabular}{lp{6cm}}\toprule \textbf{Variable} & \textbf{ Definition} \\ \midrule \multicolumn{2}{c}{\textbf{General variables used in the model}} \\ $K$ & Fixed amount of money need to start production \\ $s$ & Baseline quality of the good (normalized to 1) \\ ...


3

Almost right:-) But figure* always comes the page after it appears in the source so you can't do this on the first page (if you need that you need to do something a bit trickier) and you need \noindent to avoid a paragraph indentation making your full width tables not fit on a line. \documentclass[twocolumn]{article} \usepackage{tabularx} \usepackage{...


2

(Only now noticed your by-now month-old posting) Why this table expands beyond the page? It's happening because you're not permitting line breaks in the header cells, even though you're using a tabularx environment and column types that would, in principle, permit wrapping of text across lines. You must get rid of all \multicolumn{1}{c}{...} "wrappers" ...


3

As is often the case all errors shown after the first are essentially spurious, the error is \label{xxx}\caption{..} which should be \caption{....\label{..}} \label always needs to be after the \caption if it is to label the correct value, but in tables it is particularly bad to use this form as you get an error not just the wrong value, as the label ...


1

With some inspiration in this answer I came up with the following solution using a loop: \documentclass{article} \usepackage[table]{xcolor} \usepackage{booktabs,array,multicol} \newcommand*\TAB{&} \long\def\gloop #1\grepeat {\gdef \giterate {#1\expandafter \giterate \grepeat }\giterate } \let\grepeat\fi \newcounter{n} \newcounter{m} \newcounter{...


0

You can do that either with a hack (a real integral in the first column printed in white, with a black star as upper bound) or with the prescript command from mathtools: \documentclass{article} \usepackage[utf8]{inputenc} \usepackage[T1]{fontenc} \usepackage{lmodern} \usepackage{mathtools} \usepackage{xcolor, tabularx} \begin{document} \begin{tabular}[t]...


1

\documentclass{article} \usepackage{amsmath,tabularx} \def\RB#1{\raisebox{\dimexpr(-\height-\depth)/2}{#1}} \begin{document} \begin{tabular}{ll} $\star$ & \RB{$\displaystyle \int_0^1 f(t) dt = 1$} \end{tabular} \end{document} If you want to move the star then use \vphantom for the height of the integral. Then you do not need fixed values for the ...


1

APPROACH #1 The \upstar macro creates a row with just a star in column one, and then does an artificial shift to place it properly relative to the top of row 2. But in your input, it looks like part of row 1. \documentclass{article} \usepackage{amsmath} \usepackage{tabularx} \newcommand\upstar{$\star$ \\[\dimexpr5pt-\normalbaselineskip]} \begin{document} \...


2

A better version: \documentclass{article} \usepackage{xcolor} \usepackage{booktabs} \usepackage[colorlinks=true,linkcolor={black}]{hyperref} \usepackage{colortbl} \newcommand{\TotalMonths}{24} \newcommand{\Year}[1]{ \multicolumn{12}{c|}{#1} } \newcommand{\Quarter}[1]{\multicolumn{3}{c|}{#1}} \newcommand{\FourQuarters}{\Quarter{I} & \Quarter{II} & ...


1

Is this more or less what you want? I used the titling package, which defines 4 hooks to insert commands within the \maketitle command: \maketitlehooka, used before the _title command, \maketitlehookb, between \title and author, \maketitlehookc, between author and date, \maketitlehookd, after date. \documentclass{report} \usepackage[english , greek]{babel}...


3

The error is C{\textwidth} where that length is too wide and should be C{\dimexpr\textwidth-2\tabcolsep} to allow for the cell padding of \tabcolsep either side of the entry.


3

Here I do it with left-aligned \Longunderstacks. \documentclass{article} \usepackage{graphicx,stackengine} \setstackEOL{/} \setstackgap{L}{\normalbaselineskip} \strutlongstacks{T} \begin{document} \begin{table} \renewcommand{\arraystretch}{1.2} \centering \setlength\tabcolsep{0.5em} \scalebox{0.84} { \begin{tabular}{|l|l|l|} \hline Items & Type & ...


4

I have here added a solution without multirow, and edited the code with some more common practices in LaTeX, generally acknowledged as a more professional look, and easier to read. This solution uses booktabs, and the advice contained in that documentation to never use vertical lines, and also some horizontal lines with different widths. The scaleboxshould ...


2

Did you try aligning the table cells using the p (paragraph) mode? e.g. \documentclass[11pt,letterpaper]{article} \usepackage[showframe]{geometry} \begin{document} I would like to get the following effect without manually using ``\&'' and ``\textbackslash'' to wrap the text (i.e., all the text will be wrapped automatically). ...


1

You could use a tabularx environment and set the required width to \linewidth. The text will wrap automatically in the X-column then. Depending on your use case, a description environment can be more handy. Code: \documentclass[11pt,letterpaper]{article} % Make lists without bullets and compact spacing \newenvironment{myitemize}{ \begin{list}{}{ \...


0

Do you mean something like this: \documentclass[11pt,letterpaper]{article} \usepackage[showframe]{geometry} % Make lists without bullets and compact spacing \renewenvironment{itemize}{ \begin{list}{}{ \setlength{\leftmargin}{1.5em} \setlength{\itemsep}{1pt} \setlength{\parskip}{0em} \setlength{\parsep}{0.25em} } }{ \end{list} } \newcommand{\wrapit}[2]{% \...


2

You need to encase the inline math terms that contain \bar in \ccell instructions. Off-topic: I'd use \overline rather than \bar to denote repeating decimals. If you're going to align numbers in columns on their decimal markers, you would really help out your readers if most numbers actually contained decimal markers. Thus, write 0.00 rather than just 0, ...


1

With guessing what is missing in your (not so) MWE and omitting what I see as surpluses I obtain the following table: The code for above table is: \documentclass{article} \usepackage{siunitx} \usepackage{booktabs,makecell,multirow,tabularx} \begin{document} \begin{table*}[htb] \caption{Network density.} \label{tab6} \centering \footnotesize \...



Top 50 recent answers are included