# Tag Info

## New answers tagged horizontal-alignment

2

tocloft does only hook into ToC, LoF,LoT and the \listof... types that were defined with tocloft's \newlistof command. The glossaries package uses \printglossary[title=...] to change the optical appearance of the glossary title. Using \protect\centering\glossaryname works for the book class. \documentclass{book} \usepackage{glossaries} \...

2

uncomment your \makebox %\makebox[\figurewidth][c]{ but change the specified width to 0pt instead of \figurewidth

0

since your figure is wider than the text width, you want to make it look to latex like it is narrower. here's one possibility (just the group with the figure): \noindent\hss \begingroup \fontsize{8}{\baselinestretch}\selectfont \input{VoltFRFFreq.tikz} \endgroup \hss\par

2

I am not certain if this is what you want. I don't really have much experience with this package, and not sure how to calculate space consumed by the contents of the interactive stuff. Of course, one could store some of this inside \savebox and get the dimensions that way, but I think the interactivity would be broken, when inside a \savebox. Therefore, I ...

3

This is simply to show how to reformat the equation with as little effort as possible. Copy the line to be broken. Use \right. or \left. to balance an otherwise unmatched \left or \right. Use \hphantom to preserve spacing, and \vphantom to preserve the \left ... \right size. Note, the additional \qquad is to compensate for the missing = and \{. \...

4

You can use breqn package for this: \documentclass{article} \usepackage{amsthm,amsmath,breqn,lipsum} \usepackage[showframe,margin=5cm]{geometry} \begin{document} \lipsum[1-2] \begin{frame}[shrink=0, t]{The \textbf{\textit{DP}} Algorithm} \begin{center} \begin{minipage}{.9\textwidth} \begin{proof} \begin{enumerate} ...

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

0

You can use the \smashoperator command, from mathtools: \documentclass{article} \usepackage{mathtools} \begin{document} \begin{equation*} \smashoperator{\bigcup_{a \in \{\text{set that is very wide}\}}} S_a \end{equation*} \end{document}

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

0

Thanks for pointing out the typo. I have just figured out the problem; I'm using an online platform to run my project (overleaf), and for some reason that is what is causing the shift. I just ran it on my computer and the shift wasn't there. I'm going to contact the overleaf guys to let them know of the possible issue.

2

Grab the argument supplied to \rub and set it inside a centred box that has the width of \linewidth: \newcommand{\rub}[1]{\noindent\makebox[\linewidth]{\large\bfseries\fontfamily{pbk}\selectfont\color{red}#1}} Here is a minimal example (without the font changes, as it's not part of the discussion): \documentclass{report} \usepackage{xcolor} \...

0

Here is a solution which does not use center environment, which adds unnecessary vertical space. Output Code \documentclass[11pt]{article} \usepackage{xcolor} \usepackage{lipsum} \newcommand{\rub}[1]{% \par\hfil{% \centering% \large% \bfseries% \fontfamily{pbk}% \selectfont% \color{red}% #1% }\hfil\par} \begin{...

1


2

\newcommand*\rub[1] {\begin{center}\large\bfseries\color{red}\fontfamily{pbk}\selectfont#1\end{center}} ... \rub{This text will be centered, boldfaced, colored red and with font `pbk'} But since you did not say what you are going to use it for, we don't know if there is a more precise and correct approach.

0

Some improvement: load caption to have a decent spacing between caption and tabular (LaTeX doesn't swap the values of \abovecaptionskip and \belowcaptionskip when caption is above the float). Don't use a center environment with floats, as it adds unwanted vertical spacing. Use \centering instead, inside the table environment. Don't use \bf, \tt, &c., but ...

4

Some suggestions: Change \multirow{4}{2.5cm}{Stack} to \multirow{5}{2.5cm}{Stack} Replace all \cmidrule directives with \addlinespace Use a single \midrule after the header row Use a common line width (say, 0.1em) for all \toprule, \midrule, and \bottomrule statements. Provide more structure in the setup of the tabular environment, so that you don't have ...

1

You can move the \multirow identifiers into position using a precise \raisebox: \documentclass{article} \usepackage{booktabs,array} \begin{document} \begin{tabular}{ l >{\ttfamily}l >{\ttfamily}l } \toprule \bfseries Group & \rmfamily\bfseries Name & \rmfamily\bfseries Parameters \\ \midrule\midrule[.1em] & push & ...

2

For vertical positioning obey Mico comment, but you use in table commands from TeX not LaTeX, better and simpler code is: \documentclass[12pt]{article} \usepackage{booktabs,makecell,multirow} \renewcommand\theadfont{\normalfont\bfseries} \begin{document} \begin{table}[ht] \centering \caption{Virtual Machine Byte Code}\label{tab:vm} \begin{tabular}...

1

From the multirow-documentation: It’s just about impossible to deal correctly with descenders. The text will be set up centred, but it may then have a baseline that doesn’t match the baseline of the stuff beside it, in particular if the stuff beside it has descenders and text does not. This may result in a small misalignment. About all that can be done ...

2

A suggestion with automatic question counting at the beginning of the first column. \documentclass{article} \newcounter{questioncnt} \usepackage{array} \newcolumntype{N}[1]{>{\raggedleft\stepcounter{questioncnt}\thequestioncnt.\arraybackslash}m{#1}} \usepackage{blindtext} \begin{document} \begin{tabular}{N{2cm}p{5cm}p{6cm}} & \blindtext &...

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

1

I have tried the following code: \def\elem#1#2#3#4#5{{% \phantom{{}^{#2}_{#3}}% space for left indexes {\vphantom{\rm#1}}^{\llapscr{#2}}_{\llapscr{#3}}% llaped left indexes {\rm#1}^{#4}_{#5}% base + right indexes }} \def\llapscr#1{\llap{$\scriptstyle#1$}} Test: $\elem O {16}{8}{2-}{2}$ \bye

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

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

Not sure if this breaks other things, but here, I redefine \dot to check if the argument is a lone A and skew the dot only if that is the case (the skew level can be adjusted, of course, for the particular font). \documentclass{article} \let\svdot\dot \def\dot#1{\dothelp#1\relax} \def\dothelp#1#2\relax{% \if\relax#2\relax% \ifx A#1\skew{6}\svdot#1\...

2

You can use the multlined environment from mathtools. I took the liberty to replace the pairs of \big( … \big) and the like with \bigl( … \bigr). \documentclass{beamer} \usepackage{mathtools} \begin{document} \begin{frame} \frametitle{MWE:Split one equation in align environment} \begin{align} L_e(c_k^{(i)}) &=\log\frac{f_n(\tilde{c}_k|c_k^{(i)}=p)}{...

1

Here is one of the typical ways to achieve this alignment with respect to the = sign: \documentclass{beamer} \begin{document} \begin{frame} \frametitle{MWE:Split one equation in align environment} \begin{align} L_e(c_k^{(i)}) ={}& \log\frac{f_n(\tilde{c}_k|c_k^{(i)}=p)}{f_n(\tilde{c}_k|c_k^{(m)}=q)} \\ ={}& \log\frac{...

0

Use tabularx package. Avoid using vertical lines. \documentclass[10pt,a4paper]{report} \usepackage{booktabs} \usepackage{multirow, tabularx,array} \begin{document} \begin{table}[!h] %\renewcommand{\arraystretch}{1.2} % more space between rows \centering \caption{Particle average size obtained via TEM analysis.} \begin{...

1

You can use flalign with two "equations" in order to write a comment. Here's an example: \documentclass{article} \usepackage[fleqn]{amsmath} \setlength{\mathindent}{0pt}% No indent for full length equations (flush left) \begin{document} \noindent X \dotfill X \begin{flalign} f(x) &= ax^2 + bx + c && \text{Comment} \label{eqn:comment} \end{...

3

Since you want to have two different layouts for the same thing - \chapters - you'll have to insert content into the ToC at specific times so the formatting occurs dynamically. Below I've patched \frontmatter and \mainmatter to do exactly that. Each command inserts something specific into the ToC. \frontmatter updates \cftchapterfont by appending to it a ...

1

In order to maintain an appropriate alignment between the title and the author, set it in the same tabular that has a single column that is left aligned (removing the inter-column gap on the right via @{}): \documentclass{report} \usepackage{lipsum,graphicx} \usepackage{showframe} \title{Brief article with a very long title} \author{Company! \\ Street! \...

1

\documentclass{report} \usepackage{graphicx} \usepackage{lipsum} \usepackage{showframe} \title{Brief Article} \author{Company!\\Street!\\City!, State! ZIP!} \makeatletter \renewcommand{\maketitle}{% \begin{titlepage} \let\footnotesize\small% \let\footnoterule\relax% \let\footnote\thanks% \begin{flushleft}% \includegraphics[width=...

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

4

Answer: The trick is to nest an aligned environment within the align* one. Background Indeed, you want a local alignment (the two-line equality), within a global alignment (flushed right). The aligned environment created a fixed block, that is itself positioned relatively to the other lines. (As explained here align* environment creates a math-mode. So ...

2

7

\documentclass{article} \usepackage{lipsum} \begin{document} \lipsum[1] \noindent A\hfill B\hfill C \lipsum[1] \end{document}

5

There are better solutions, but one based on your idea with \centerline is very easy: \leftline{Left \hfill Center \hfill Right}

0

I propose a slightly different layout, playing with the overhang parameter of \columncolor, still based on siunitx. tabularx is not needed. Note that, with the table option for xcolor, you don't have to load colortbl. Also, the code is simplified with the \rowcolors command. \documentclass[a4paper,11pt]{article} \usepackage[T1]{fontenc} \usepackage[utf8]{...

1

The tokens \vspace{2.5pt}\noindent are completely out of place there. Here's a realization with siunitx: \documentclass[a4paper,11pt]{article} \usepackage{array} \usepackage{tabularx} \usepackage[table]{xcolor} % don't load colortbl after xcolor, use the option \usepackage{siunitx} \definecolor{Grey}{gray}{0.8} \definecolor{Groy}{gray}{0.9} \begin{...

1

Here's a suggestion which doesn't use nesting of tikzpictures. To position the plots I've simply positioned origingreen relative to the teacher2 node using \coordinate (origingreen) at ([yshift=-5cm,xshift=0.5cm]teacher2.south west);. The axis lines are already drawn relative to the origin, so what remains is to shift the plot, and that you can do by adding ...

1

Thanks to Axel Sommerfeldt's solution to a similar issue described in Compatibility issue with \renewenvironment{figure} and [H] placement I was able to solve the problem by patching \float@endH from the float package as well. \documentclass[]{article} \usepackage{mwe} \usepackage{changepage} \usepackage{float} \makeatletter \newenvironment{shiftedfloat}[...

0


2

Almost the same as Zarko's solution. I slightly enlarged the left-hand minipage, and suppressed both {} on both sides of the tables, but used a cropped \cmidrule instead of \midrule. Also, palatino is obsolete, as it modifies only the text font, andd cmmaths are still used, which is ugly with palatino text. So I replaced it with mathpazo(cf. the l2tabu ...

3

Like this: For above picture you need enlarge width of the first \minipage that the caption can be placed in one line only ... In complete code below I made some small changes in comparison to your MWE. For the first table is used tabularx. With it I got better looks of tables and respective captions. \documentclass[12pt,a4paper]{report} \usepackage[...

1

Starting with KOMA-Script version 3.20 you can use \documentclass{scrbook}[2016/10/05] \RedeclareSectionCommands[tocdynnumwidth]{chapter,section} \RedeclareSectionCommands[tocpagenumberbox=\pagenumberbox] {part,chapter,section,subsection,subsubsection,paragraph,subparagraph} \newcommand\pagenumberbox[1]{% \makebox{\enskip #1}% } \begin{document} \...

2

You need an updated version of \@makechapterhead since the current one doesn't allow for the line breaks since it uses \centerline. Instead using \centering: \def\@makechapterhead#1{% % \vspace*{50\p@}% {\parindent \z@ \raggedright \normalfont \centering \ifnum \c@secnumdepth >\m@ne \large\bfseries \@chapapp\space \thechapter \...

0

Please note that this code cannot be recommended without a good many caveats and qualifications, warnings and protests, injunctions and admonitions. Not only do I not know what I'm doing, it relies on code marked as experimental by the LaTeX 3 developers. Unlike me, they do know what they're doing, so if they say they're not sure what they're doing, it must ...

Top 50 recent answers are included