Tag Info

New answers tagged

3

As in the solutions by David Carlisle and egreg mentioned: counters should not be defined on-the-fly. I used a similar approach as David Carlisle, providing a \NewDocumentCounter, \DeclareRequirement, DeclareRequirements commands which can be used in preamble only, to prevent accidental usage. \documentclass{article} \usepackage{enumitem} ...


4

You can't define counters while tabularx does its job. A solution may be to define the one you need in a tabularx beforehand, or do it in a delayed fashion using the .aux file. \documentclass{article} \usepackage{enumitem} \usepackage{etoolbox} \usepackage{booktabs} \usepackage{ltxtable} \usepackage{ltablex} \usepackage{cleveref} \makeatletter ...


3

You should almost never declare a counter within a macro, it should be declared once in the preamble and just used. then tabularx would know about it and preserve its value when doing trial width settings. \documentclass{article} \usepackage{enumitem} \usepackage{cleveref} \usepackage{etoolbox} \usepackage{booktabs} \usepackage{ltxtable} ...


3

If you want to change \begin{tabu} to <dimen> into \begin{tabularx}{<dimen}, while keeping normal tabu environments you can do \documentclass{article} \usepackage{tabularx,tabu} \makeatletter \let\originaltabu\tabu \def\tabu#1#{% \setbox\z@=\hbox#1{}% \ifdim\wd\z@=\z@ \expandafter\@firstoftwo \else \expandafter\@secondoftwo \fi ...


2

Here is how I would typeset the table: \documentclass{article} \usepackage[margin = 4cm]{geometry} % to avoid `overfull \hbox' warning \usepackage[tableposition = top]{caption} \usepackage{mathtools} \usepackage{siunitx} \usepackage{booktabs} %\usepackage[version = 3]{mhchem} % use if you have more than a few chemical symbols ...


1

\newline won't work inside c column type. You can use tabularx and its X column instead. \documentclass{article} \usepackage{amsmath,tabularx} \title{Latex File} \author{Noob} \date{\today} \begin{document} \maketitle \renewcommand{\arraystretch}{1.2} \noindent \begin{tabularx}{\textwidth}{XXXXXX} \hline \hline Nuclide & Gamma-Ray Energy (keV) & ...


6

It's not clear that there is really an issue to be solved, it is only an issue for tables if you think there is an issue about tables. Most of the points that you raise could also be made about "paragraphs" or "lists", at some point you have to have some structural information as well as words. It is easy to have an environment that defaults the column ...


1

I have solved 1 and 2. For 3, I am confused and think that that won't be a nice idea. However, you may add custom text along side continued on next page. \documentclass[12pt]{article} \usepackage{tabularx,longtable,booktabs} %\usepackage{ctable} %% don't use this \begin{document} \setlength\extrarowheight{4pt} ...


1

Use hhline \documentclass[margin=2mm]{standalone} \usepackage{hhline} \begin{document} \begin{tabular}{c | c } & \\ \hline & \\ \hhline{=|=} & \\ \hhline{=|=} & \\ \hhline{=|=} & \\ \hhline{=|=} & \\ \hline \end{tabular} \end{document} Response to the comment. It is only the viewer artefact. Zoom in and ...


1

I know there is a package that can do this (which I cannot recall), but here it is hardwired as \dhline, which must be defined based on the point size of the document (since I don't know the macros that define the rule thicknesses and vertical skips inside tabular) \documentclass[11pt]{article} %\def\dhline{\\[-10.2pt]\hline\\[-14.2pt]\hline\\[-10.pt]}% for ...


1

It is not entirely clear to me what you are asking. Presumably you just want to typeset this table. I recommend using the booktabs package and, for the reasons discussed in the documentation for this package, I recommend against using vertical lines and, as Mico says, not too many horizontal lines. I would write this table as: ...


2

I think you need to make two adjustments to the code: First, as already noted by David Carlisle, you need to add the [t] position specifier to the inner tabular environment. Second, you need to remove the extra whitespace that's surrounding the inner tabular -- remember that the c column type of the outer tabularx environment already provides whitespace ...


4

You can do that with a simpler syntax if you use the makecellpackage, which allows for a common formatting, vertical/horizontal alignment and line breaks in cells introduced by the \makecell command. A small patch allows to have the vertical and horizontal alignment of the cell as an optional argument (default is cc – vertically and horizontally centred). In ...


4

You are aligning the top line of the paragraph with the centre of the tabular. Use \begin{tabular}[t] so that the top line of the tabular is taken as the alignment point, which will then align with the top line of the paragraph in the first column.


2

It would be difficult to integrate tabularx into the option list of the macro \csvreader; for an environment, there would be ways. But you can always put a tabularx environment around a \csvreader. The following example shows, how to do this: \begin{filecontents*}{mycsv.csv} This,is,my,example Red,Green,This is some very very long text,This is also some ...


3

% arara: pdflatex % arara: pdflatex \documentclass[10pt,letterpaper]{article} \usepackage{booktabs} \usepackage{siunitx} \newcommand{\cenMultlCell}[2][c]{\begin{tabular}[#1]{@{}c@{}}#2\end{tabular}} \usepackage[colorlinks=true, linkcolor=black]{hyperref} \begin{document} \begin{table} \footnotesize\centering % needed, as table is to wide ...


1

You can just use X which gives you the basic unit width for an expanding column, but you need to double it and allow for the 2\tabcolsep in the middle. \documentclass[a4paper,11pt]{article} \usepackage{lipsum} \usepackage{tabularx} \usepackage{calc} \begin{document} \begin{tabularx}{\textwidth}{l | X X} \hline Short & \textbf{This text is a little ...


2

I have the following suggestions: To center the elements of a column in a tabular environment, use the c column type instead of l or r. To center a tabular environment inside a table environment, use the \centering instruction. You have several \multicolumn{1}{|c|}{...} "wrapper" statements. They don't exactly hurt, but they don't seem to be necessary ...


1

Just replace the r's and l's with c's in the tabular definitions. And a bit of code reorganization will make it easier to edit. \documentclass[10pt,letterpaper]{article} \begin{document} \begin{table}[h] \begin{tabular}{|c|c|c|c|}\hline \multicolumn{1}{|c|}{text} & \multicolumn{3}{c|}{Aproach}\\ \hline another text & other one & another one ...


3

Here are two ways of getting around the problem. Your usage is correct, but you're not counting the number of \tabcolseps correctly. There are 6 within your table stemming from the tabularx preamble {l | X X}. Let's denote a \tabcolsep using t, then you'd have {tlt|tXttXt}. Moreover, the calculation of \hsize is for the entire "tlt-column", so it already ...


4

Set \mylength to the width of Short (or whaterver you use) \newlength{\mylength} \settowidth{\mylength}{Short} and then p{\textwidth-4\tabcolsep-\arrayrulewidth-\mylength\relax} should do it. \documentclass[a4paper,11pt]{article} \usepackage{lipsum} \usepackage{tabularx} \usepackage{calc} \newlength{\mylength} \settowidth{\mylength}{Short} ...



Top 50 recent answers are included