# Tag Info

## New answers tagged horizontal-alignment

3

You can use the fleqn option for amsmath: \documentclass{article} \usepackage[fleqn]{amsmath} \begin{document} $\sigma(s,i) = \begin{cases} \tau_{si},\quad &\text{si } \{s,i\} \in E \\ \infty, & \text{sinon.} \end{cases}$ \end{document} The \quad command is optional (though recommended by some authors) and introduces some ...

3

Just use a single enumerate environment and use \item[C:] for your comments.

2

One possible solution is to define a list-like environment with the appropriate settings for the comments: \documentclass{article} \usepackage{enumitem} \newlist{mycomm}{enumerate}{1} \setlist[mycomm]{align=left,label=\bfseries C:} \newcommand\mycomment[1]{% \begin{mycomm}\item#1\end{mycomm}} \begin{document} \begin{enumerate}[align=left, ...

2

For such a color box problem I would recommend a color box package like mdframed or tcolorbox. A tcolorbox solution would be: \usepackage{tcolorbox}% preamble AFTER \usepackage[usenames,dvipsnames]{color} ... \newcommand{\headergrey}[1]{% \begin{tcolorbox}[enlarge left by=-15pt,width=\linewidth+15pt, ...

2

The margin option to this class has the effect of moving the left margin in an amount correspanding to \sectionwidth. You need a way to provide either text in the left margin, like the section headings, or text sperading accross the full page. Here is some code to achieve this: \documentclass[margin, 10pt]{res} \usepackage{helvet} ...

1

You have to move to the left by \hoffset \documentclass[margin, 10pt]{res} \usepackage{helvet} \setlength{\textwidth}{5.1in} \begin{document} \moveleft.5\hoffset\centerline{\large\bf John Smith} % Your name at the top \moveleft\hoffset\vbox{\hrule width\resumewidth height 1pt}\smallskip \moveleft.5\hoffset\centerline{123 Broadway} ...

1

Taking the user's question a step further, I have created the algneqn environment which will align the equation contents on the tab character. The user must specify two constrained parameters (fractions of textwidth for left and right side of alignment) that will govern where that alignment tab is set on the horizontal line. And unlike \intertext ...

2

Is the following what you are looking for? \documentclass{article} \usepackage{mathtools} \begin{document} Something \begin{align*} AAA &= BBBBBBBBBB,\\ \shortintertext{and} C &= DD. \end{align*} \end{document}

3

\documentclass{article} \usepackage{amsmath} \begin{document} blabla-bla-bla \begin{align} y&=z+r+c \label{s1}\\ \noalign{\text{blabla-blah} } y_{321}&=z_3+r_2+c_1 \label{s2} \end{align} \end{document}

3

If you know the default distance between two lines in a cases environment, then the solution is not difficult: start the cases with the appropriate negative vertical space so that the brace doesn't cover the header, and adjust with a positive vertical space before the cases so that there's no overlap with the preceding text. \documentclass{article} ...

4

You could put the header text inside one of the cases, but then smash it, so that its presence doesn't affect the size of the brace. To make sure that the equation has the right amount of space above it, you can then wrap the whole thing in an array whose first row contains the right amount of vertical space (as egreg suggested in a comment below). ...

1

As far as I understand, you are expecting the following alingment: \documentclass{article} \usepackage{amsmath} \begin{document} Further we can show that \begin{equation*} P_{v}(T) = % \begin{cases} \begin{array}{l} \text{Reduction of $E$ at $v$:} \\ ...

3

You want a modified description environment. \documentclass{article} \usepackage[pass,showframe]{geometry}% just for the example \usepackage{enumitem} \newlength{\mydesclen} \newenvironment{mydesc}[1] {\settowidth{\mydesclen}{\textbf{#1} --- }% \newcommand{\mitem}[1]{\item[\normalfont\textbf{##1} --- ]}% \begin{description}[ ...

3

You could use a tabular environment. Be mindful of overfull boxes, though. \documentclass{article} \begin{document} \noindent \begin{tabular}{r@{\ }l} \textbf{Software} --- & MS Office Powerpoint, Software 1, Software 2, Software 3, Software 4,\\ & Software 5, Software 6, Software 7, etc. etc. \end{tabular} \end{document} ...

3


1

How about \documentclass{article} \usepackage[english]{babel} \usepackage{blindtext} \usepackage{epigraph} \usepackage{ragged2e} \begin{document} \epigraph{\justifying\blindtext}{source} \end{document}

3

\documentclass{article} \usepackage{dcolumn} \newcolumntype{C}{>{\centering}p{1cm}} \newcolumntype{E}{D{.}{.}{5.0}} \begin{document} \begin{tabular}{C E} xxx & \multicolumn{1}{c}{\textbf{head of col}}\\ y y y & 120\\ z z z z z & 42001 \end{tabular} \end{document}

6

\documentclass{article} \usepackage{amsmath} \begin{document} \begin{equation*} \left.\smash{\raisebox{-.7\baselineskip}{\left\{\begin{aligned} A+B&=X\\ B+C&=Y\\ C+A&=Z \end{aligned}\right.}} \rule{0pt}{1.3\baselineskip} \right\} 2A+B+C=X+Z \end{equation*} \end{document}

4

There are three spaces you don't take into account. A \left...\right construction has a thin space before and after it; An empty delimiter produces a space as wide as \nulldelimiterspace; aligned has a thin space before it (see Why is there a \, space at the beginning of the "aligned" environment?). Here's how remove those spaces: ...

4

Hide the width of the comment \begin{center} some textual claim \\ $\Updownarrow$ \\ more text \\ $\Updownarrow$\rlap{ - some comment} \\ last text \end{center}

1

I have a not so elegant solution using \minipage. That works fine for the casual style but it should work for the other ones as well. Before \begin{document}, add: \newlength{\currentparskip} Then, when writing the letter, after the \makelettertitle command, put: \setlength{\currentparskip}{\parskip}% save the value of paragraph spacing ...

11

There are two problems in your input. A new paragraph is started with the first minipage, which adds the indent. There is a space between the two minipages. \documentclass[draft=on]{scrbook} \usepackage{blindtext} \begin{document} \noindent \begin{minipage}{.5\textwidth} TEXT 1 \end{minipage}% This must go next to \end{minipage} ...

2

The code \documentclass[11pt,a4paper]{book} \title{title here} \author{author here} \date{date here} \begin{document} \maketitle \end{document} produces the output Edit: As pointed out by @Gonzalo Medina, if you want to use the article class, just change the first line of the code to \documentclass[titlepage]{article}.

3

The problem in this case is with \addvspace (hidden in the definitions of center and \centering) being called outside vmode, as the following simple example demonstrates: \documentclass{article} \usepackage{rotating} \begin{document} \begin{sideways} \addvspace{3em} This is some centered text... \end{sideways} \end{document} This code triggers the ...

2

Font styling of elements like title are controlled by corresponding commands of the form \titlefont. The default in your case is \LARGE\mdseries\slshape. So to get upright, replace the latter by \upshape. For the positioning the title, I am afraid you have to copy the style file's definition of \makecvtitle and remove the \hfill before the title ...

8

\documentclass{article} \def\foo{\hspace{\fill}\mbox{}\linebreak[0]\hspace*{\fill}} \begin{document} \hrule % show the margins \bigskip \rule{32em}{.2ex}\foo \mbox{S o m e t h i n g} \bigskip \rule{28em}{.2ex}\foo \mbox{S o m e t h i n g} \bigskip \rule{21em}{.2ex}\foo \mbox{S o m e t h i n g} \bigskip \rule{12em}{.2ex}\foo \mbox{S o m e t h i n ...

3

Inside the table float, right click, choose Paragraph settings, and set the Alignment to Centered.

1

Thank you all very much. I've been able to work out how to move the chapter headings to the left margin. In the titlesec package it says: Notes. \titlespacing does not work with either \chapter and \part unless you change its title format as well by means of \titleformat, the simple settings, or \titleclass. In the following MWE I managed to get it ...

2

I think something along these lines can be achieved with the titlesec package (and no doubt others too!). I find it voodoo-ish (and, for a person like me, I could do with more examples in the documentation), but this seems to work: For the section \newcommand{\titlebox}[1]{% \parbox[t]{2.5cm}{\raggedright #1}} \titleformat{\section} ...

2

the definition in amsbook specifies paragraph indentation at the beginning and a run-in heading. those have to be overruled. this code will do it: \makeatletter \def\subsection{\@startsection{subsection}{2}% \z@{.5\linespacing\@plus.7\linespacing}{.25\linespacing}% {\normalfont\bfseries\centering}} \makeatother i've set the spacing below ...

1

Solved by adding inner sep=0em to the matrix. \matrix[matrix of nodes, row sep=0.4em,inner sep=0em, ... See the generated PDF.

4

\documentclass{minimal} \def\signed#1{{\leavevmode\unskip\nobreak\hfil\penalty50\hskip2em \hbox{}\nobreak\hfil #1% \parfillskip=0pt \finalhyphendemerits=0 \endgraf}} \begin{document} Phasellus sagittis blandit tortor, vitae facilisis nisl molestie a. Proin suscipit, purus in scelerisque bibendum, ligula magna hendrerit mauris, et condimentum ...

6

Try removing the line \raggedright. ('Ragged right' is how you get left-aligned text in LaTeX. There's also a \raggedleft for right-aligned text.) Edit: If you only want part of your document to be left-aligned, then make sure \raggedright occurs inside a pair of braces. Otherwise it will ruin your whole document! For example, to make just your disclaimer ...

3

For your comment, use \renewcommand{\algorithmiccomment}[1]{\hfill(#1)\ignorespaces} which gobbles any spaces after \COMMENT, effectively being the same as inserting % after each one. See What is the use of percent signs (%) at the end of lines?

2

A work around is to comment out the end of line characters after the \COMMENT commands: \documentclass{article} \usepackage{algorithmic} \renewcommand{\algorithmiccomment}[1]{\hfill(#1)} \usepackage{hyperref} \begin{document} \begin{algorithmic} \STATE foo \COMMENT{bar}% \FOR{foo} \STATE foo \COMMENT{bar}% \STATE foo \COMMENT{bar}% ...

3

You should add >{\centering} before the relevant column, or more conveniently define a new column type as follows: \documentclass{article} \usepackage{tabularx} \newcolumntype{Z}{>{\centering\arraybackslash}X} \begin{document} \begin{tabularx}{\textwidth}{ |Z|Z|Z|Z|Z|Z| } \hline Equation & 2 & 3 & 5 & 7 \\ \hline $y_0 = b^{t}$ ...

1

By default, LaTeX's standard document classes will center a float that occupies a page by itself vertically; providing a location specifier such as [t] won't override this. If you want to the two floats to be top-aligned, you could issue the following commands: \makeatletter \setlength{\@fptop}{0\p@} \setlength{\@fpbot}{0\p@ \@plus 1fil} \makeatletter If ...

2

Here's my attempt at this. Looking at the problem, it seems you need three things: Each row should have two columns. The first column should be centered, and the second column should be aligned (say) a \quad to the right of it. The lines should be numbered. Multiple columns suggests align; centering of equations suggests gather. You can't have both at ...

2

I did find an alternate way and this seems to work just fine. Probably a bit simpler than Gonzalo's solution. Caveat: You need to have either the IEEEtran document class or use the IEEEtrantools package \begin{IEEEeqnarray}{Ccc} %3 column layout to align the equations \label{eqn:startEraser} \max d && \\ %empty 2nd/3rd columns ...

7

Here's one possibility; I used an align environment to align the quantified expressions; to get the left parts centered, I used some boxes with centered content; the \Ceneq command places its argument in a box whose width correspomds to the wider expression: \documentclass{report} \usepackage{amsmath} \newlength\longest \newcommand\Ceneq[1]{% ...

6

What about this? \documentclass[12pt]{article} \usepackage{mathtools} \begin{document} \begin{displaymath} \overbrace{(r+\epsilon)V_t}^{\text{\clap{Required return}}} \quad = \quad \underbrace{\overbrace{D^e_t+V_{t+1}^e}^{\text{\clap{Expected capital gain}}} - V_t}_{\text{\clap{Total expected return on shares}}} \end{displaymath} ...

0

The idea is to use your code, and then to use an additional list (with the help of the changepage package), as a wrapper, to get the desired leftmargin. The newly defined environment mdesc needs to know the widest label, to make the necessary calculations; this longest label must be given as a mandatory argument to the environment: \documentclass[paper=a4, ...

2

Here's a quick and dirty way to achieve what you want. All I did was change your \SetLabelAlign{rightbox}{\hss\llap{#1\quad}} to \SetLabelAlign{rightbox}{\hspace{-19ex}\rlap{#1\quad}} Output before: Output after: The complete code becomes: \documentclass{article} \usepackage{enumitem} \begin{document} ...

0

You have the framework already in place- the only thing to change is the section formatting. The titlesec is very helpful here- the only thing I had to add was % custom section \titleformat{\section} {\normalfont\Large\bfseries} {\llap{\thesection\hskip.5cm}} {0pt} {} Here's the output % arara: pdflatex % !arara: indent: {overwrite: on} ...

0

I'm not sure how to directly align the paragraph with the section name. Someone else probably will. Instead, here is a way to mock up a similar layout, using longtable. See what you think. \documentclass[paper=a4, paper=portrait, pagesize=auto]{scrartcl} \usepackage{longtable} \usepackage{xcolor} \usepackage{booktabs} \usepackage{graphicx} ...

5

Tikz matrices define the styles column X which allows to pass separate options (in this case, anchor) for different columns. For the record, the row X styles are the equivalent for rows, and you can combine both to refer to a specific cell. \documentclass[border=5pt]{standalone} \usepackage{tikz} \usetikzlibrary{matrix} \begin{document} ...

3

I hope I understood the question correct Using the package enumitem you can specify the label position and the alignment of the label by \SetLabelAlign \documentclass[paper=a4, paper=portrait, pagesize=auto]{scrartcl} \usepackage[inline]{enumitem} \usepackage[table]{xcolor} \definecolor{orange}{HTML}{FFC296} \begin{document} ...

3

Another possibility, with inequality signs vertically aligned, but keeping the cost and equality constraint to the left: \documentclass{article} \usepackage{amsmath} \DeclareMathOperator{\diag}{diag} \begin{document} \begin{align*} \text{minimize} \quad & \lVert A^{\text{ind}} w \text{ diag}(x^{\text{ind}})\rVert \\ \text{subject to} \quad & ...

4

here's another possibility, although whether it's preferable to the one by percusse is a matter of personal taste. \documentclass{article} \usepackage{amsmath} \DeclareMathOperator{\diag}{diag} \begin{document} \begin{gather*} \begin{split} \llap{\text{minimize}\qquad\qquad} & \| A^{\mathrm{ind}} w \diag (x^{\mathrm{ind}})\| \\ \llap{\text{subject ...

10

The following may be close to what you're looking for: \documentclass{article} \usepackage{amsmath} \DeclareMathOperator{\diag}{diag} \begin{document} $\text{Minimize\quad} \| A^{\text{ind}} w \diag(x^{\text{ind}}) \|$ \[ \begin{array}{r @{}c@{} c @{}c@{} l} \text{subject to:\quad}w&{}={}&\multicolumn{1}{@{}l}{b-s+w^0}\\ l^b &\le& b ...

Top 50 recent answers are included