New answers tagged

5

Yes, the syntax is \begin{tabularx}{<width>}[<pos>]{<col spec>} % tabular content \end{tabularx} Here is you example: \documentclass{article} \usepackage{tabularx} \newenvironment{cheeselist} {\begin{enumerate}} {\end{enumerate}} \newenvironment{cheese} {\item \tabularx{\linewidth}[t]{l X}} {\endtabularx} \newcommand{\...


1

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}{\...


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

Here is a minimal example which compares your approach (the vertical fills, which are ok IMHO) with the approach I proposed in a comment (to put it all inside a tikz node which is drawn at the absolute center of the page). \documentclass{article} %\usepackage[showframe]{geometry} % uncomment to see the margins \usepackage{mwe} \usepackage{float} \usepackage{...


0

Bernard, thank you very much! Here is what I did in the end: \begin{center} \sisetup{table-format=2.2, output-decimal-marker={,}} \setcellgapes{2pt}\makegapedcells \begin{tabular}{rcrrlclSl} \multicolumn{1}{c}{$i$} & classes & \multicolumn{1}{c}{$x_i$} & \multicolumn{1}{c}{$f_i$} & \multicolumn{1}{c}{${\scriptstyle f_{r_i} = \frac{f_i}{n+1}}...


1

this worked for me. :D \begingroup% \makeatletter% \cleardoublepage% \let\newpage\relax% \let\clearpage\relax% \vspace*{\fill}% \vspace*{\dimexpr-50\p@-\baselineskip}% Remove the initial %% -default- 50pt gap (plus 1 line) \chapter{Hello World} \vspace*{\fill}% \endgroup%


0

The way to centre cell contents in a Scolumn is to enclose it in brackets. I took the liberty to code an improved version of your table, using booktabs for the horizontal line, in order to have some vertical padding around it. Also, I defined the first column to have S type, to ensure the vertical centring of decimal dots (it would be lost if all elements ...


1

You could typeset the whole table with S column specifier provided by siunitx and specify the format for the numbers in the optional argument with table-format. \documentclass{article} \usepackage{siunitx,booktabs} \begin{document} \begin{center} \sisetup{table-number-alignment = center , output-decimal-marker = {,}} \begin{tabular}{% @{}S[...


1

Using dcolumn also you can adjust the alignment. Now you are using siunitx package. See below code: \documentclass{article} \usepackage{dcolumn} \newcolumntype{d}[1]{D{.}{.}{#1}} \begin{document} \begin{center} \begin{tabular}{cccd{3.0}} \multicolumn{1}{c}{$C$} & \multicolumn{1}{c}{$M_i$} & \multicolumn{1}{c}{$m$} & \multicolumn{1}{c}...


0

Just replace the S in your tabular definition with r to align the contents of this column to the right. \documentclass{article} \begin{document} \begin{center} \begin{tabular}{cccr} \multicolumn{1}{c}{$C$} & \multicolumn{1}{c}{$M_i$} & \multicolumn{1}{c}{$m$} & \multicolumn{1}{c}{$G'_i$} \\ \hline 28,2 & 2 & 21 & 80 ...


2

Perhaps something like this? \documentclass{article} \usepackage{multirow, rotating, graphicx} \usepackage{siunitx, makecell, bigstrut} \begin{document} \begin{center} \sisetup{table-format=2.2, output-decimal-marker={,}} \setcellgapes{2pt}\makegapedcells \begin{tabular}{r|c|r|r|l|c|l|S|l} \multicolumn{1}{c|}{$i$} & class & \multicolumn{1}{c|}{$...


2

Could any of you tell me ... why is it that I’m not seeing vertical column dividers in the first row except before "classes"? It's because of the \multicolumn{1}{c}{...} "wrappers"; if you want a vertical divider at the end of the column, write \multicolumn{1}{c|}{...}. For what it's worth, I would get rid of all vertical dividers. They aren't needed, and ...


1

You can use dcolumn package: \documentclass{article} \usepackage{dcolumn} \newcolumntype{d}[1]{D{,}{,}{#1}} \begin{document} \begin{tabular}{r|c|r|r|l|l|l|d{2,2}|l} \multicolumn{1}{c}{$i$} & classes & \multicolumn{1}{c}{$x_i$} & \multicolumn{1}{c}{$f_i$} & \multicolumn{1}{c}{$f_{ri}$} & \multicolumn{1}{c}{$\sum f_{ri}$} & \...


3

You can use alignat to remove the gaps between the alignment marks &: \documentclass{article} \usepackage{mathtools,eqparbox} \begin{document} % Original alignment \begin{align} \cdots\text{ABB}&\bigg|\text{BAABB}&\bigg|\text{AAABB}&\bigg|\text{BB}&\bigg|\text{BB}&\bigg|\text{ABABAABABB}&\bigg|\text{AA}\cdots \\ n_0 &...


3

Here is a solution, if I've well understood what you want. It's based on the code for the \vdotswithin command from mathtools. So I define a \vertwithin{label} command, which puts the \vert command centred in a box of width the labelwidth, and uses this box as alignment point. B.t.w., for n alignment points, you need 2n-1 ampersands. Also, you don't have ...


3

The first \hline command is causing the trouble. If you remove it, the table is aligned. If you want a horizontal line on top, use the array-package and the \firsthline command. MWE: \documentclass{standalone} \usepackage{array} \begin{document} LEFT \begin{tabular}[t]{ll} First & \begin{tabular}[t]{|l|l|} \firsthline Line & 1 \\ \hline ...


1

Consider using adjustbox to vertically align the tabulars to the \items as the default [t]op and [b]ottom alignments when including horizontal rules - \hlines - influences it: \documentclass{article} \usepackage{adjustbox} \begin{document} \begin{enumerate} \item \adjustbox{valign=t}{\begin{tabular}{|c|c|} \hline Lorem & Ipsum \...


1

Just raise every arrow. Once finished, tikzpictures are aligned on its baseline. In this case, tikzpicture dimensions are 1cm long and almost nothing high. Coordinates (-1,2) and (0,2) only have sense inside the tikzpicture, but once finished only picture size matters. Therefore vertical position 2 means nothing in this case. But you can use a \raisebox ...


1

I faced similar problem, & found a (not conventional though) simple way to solve it. Wish it will help others too. I had a table like this- \begin{tabular}{c|ccc} $x$ & 1 & 2 & 3\\ \hline $f(x)$ & 1 & 2 & 3 \end{tabular} And, I wanted to put some extra space before the second column- So, I inserted an extra empty line- \...


1

The parentheses ( and ) are special characters inside \chemfig. They denote branching (and also are part or the ring syntax). \chemfig{(Si)} starts a branch after an empty atom which in effect seems to shift the baseline. \documentclass{article} \usepackage{chemfig} \begin{document} X\chemfig{H-C-H}X\chemfig{C}X \par X\chemfig{-C-}X\chemfig{(C)}X \end{...


0

Thanks to this question I understood what's going on and how to fix it. Actually I had already given the right hint in the question: By setting \parskip to 0pt I prevented LaTeX to use the inter-paragraph space to adjust the vertical spacing of the page. The (or rather a) solution is to use "glue" space for that length: \setlength{\parskip}{0pt plus \...


3

By using the package tcolorbox, this can be achieved: MWE: \documentclass{article} \usepackage{multicol} \usepackage{tcolorbox} \begin{document} \pagestyle{empty} \bigskip \centerline{\huge XXXXXXX} \bigskip \setlength{\columnseprule}{1pt} \def\columnseprulecolor{\color{green}} \begin{tcolorbox}[ sharp corners=all, colback=white, colframe=green, ...


2

With help of package adjustbox you can obtain: In the first row the margin above and below picture is added, in the second row the image is without added margins. The code: \documentclass{article} \usepackage{graphicx} \usepackage[export]{adjustbox} \begin{document} \begin{table}[htbp] \centering \caption{My caption} \label{tab:mytab} \...


2

In the provided example, a minus sign was left off the length .5\totalheight. Graphical images are set above the baseline, when using \includegraphics, whereas tabular cells are centered. Thus, one must move the graphical image down by half its height to compensate. \documentclass{article} \usepackage{graphicx} \begin{document} \begin{table}[htbp] \...


5

The problem is that the block array is vertically centered with respect to its entire size, including the indices below. The easiest way, in this case, is to put the whole thing in the blkarray. \documentclass[a4paper,12pt]{article} \usepackage{amsmath} \usepackage{blkarray}% http://ctan.org/pkg/blkarray \begin{document} \[ \begin{blockarray}{r@{}...


5

You can obtain this result either with pmatrixand pstricks, defining certain elements as nodes, and attaching labels to these nodes, or with blockarray, stackengine or makecell, and a \raisebox command: \documentclass[a4paper,12pt]{article} \usepackage{mathtools} \usepackage{blkarray, makecell, stackengine} \usepackage{pst-node, auto-pst-pdf} % \begin{...


1

Of course, you still have to count lines this way. \documentclass{article} \usepackage{graphicx} \usepackage{afterpage} \usepackage{caption} \usepackage{showframe} \begin{document} \section{aaa} aaaa one two three four five six seven eight nine ten one two three four five six seven eight nine ten one two three four five six seven eight nine ten \rule{...


3

If you let tex page break normally and note where it breaks the page you can force a "hidden" paragraph break at exactly that spot and insert th ewrapfig: \documentclass{article} \usepackage{graphicx,wrapfig} \begin{document} \section{aaa} aaaa one two three four five six seven eight nine ten one two three four five six seven eight nine ten one two ...


2

By only providing a code fragment, it makes it tough, because we have to imagine what all the undefined commands might mean. First I assumed a typo in the question that you wanted the alternate format if position or LOCATION were absent (since why would you want the date if date were absent). Then I assumed that the \Xstyle commands were merely text styles....


5

I couldn't resist to propose a small variant to Steven B. Segletes' solution using a font which has contextual historic S (EBGaramond doesn't, unfortunately), and a centred dot not on the base line. It compiles with xelatex or lualatex.. \documentclass[12pt]{article} \usepackage{stackengine} \usepackage{fontspec} \setmainfont{Sabon Next LT Pro} \...


9

Credit to Joseph at Detect which text "mode" (normal, italic, bold, etc.) is currently in use? for helping to determine if in italic shape. If so, an extra kern is applied to the over-script (relative to the dot below) to make it aesthetically compatible with italic shape. Note that I chose to center the dot under the first letter of the over-...


12

Centering is easy; the collision is cured by \/. \documentclass[12pt]{article} \usepackage[T1]{fontenc} \usepackage{ebgaramond} \newcommand{\oa}[1]{% \/{\ooalign{\textsuperscript{#1}\cr\hidewidth.\hidewidth\cr}}% } \begin{document} M\oa{o} Salazar, Villan\oa{co} al SS\oa{mo} a 8 {\itshape M\oa{o} Salazar, Villan\oa{co} al SS\oa{mo} a 8} \end{...


4

Yes, this can certainly be done. Try the following: \documentclass{article} \thispagestyle{empty} \newlength{\dotcenterwd} \def\dotcenter#1{% \settowidth{\dotcenterwd}{\textsuperscript{#1}}% \hbox to\dotcenterwd{\textsuperscript{#1}}% \kern-\dotcenterwd% \hbox to\dotcenterwd{\hfil.\hfil}% }% \begin{document} \Huge M\dotcenter{o} \textit{M\...


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} \...


1

Package tcolorbox also offers another way of distributing graphics/tabulars and text side by side. \tcbsidebyside box accepts two parameters, left and right contents to be distributed side by side, and sidebyside adapt option allows to declare which part will define space distribution. sidebyside align defines vertical alignment of both parts. With TikZ ...


1

Put the first \begin{minipage} just before \section{Imagenes}.



Top 50 recent answers are included