Tag Info

New answers tagged

1

You should read the document first. For ctex v1.02d and older version: \CTEXsetup[format=\Large\bfseries]{section} For ctex v2.0 and later: \ctexset{section/format=\Large\bfseries}


1

You could consider setting the text inside a full-width tabularx. This allows you to have line-breaks (and/or paragraphs) inside the respective cells: \documentclass{article} \usepackage{tabularx} \begin{document} \noindent \begin{tabularx}{\textwidth}{@{}X@{\qquad}X@{}} \multicolumn{2}{c}{onlyoneword} \\ \raggedleft sveeeeeeeeeerylongword & ...


3

Make boxes. And never use \centerline in LaTeX. \documentclass{article} \usepackage{showframe} % just to show the text block margins \begin{document} \noindent\makebox[\textwidth]{onlyoneword}\\* \makebox[\dimexpr.5\textwidth-1em][r]{sveeeeeeeeeerylongword}% \qquad \makebox[\dimexpr.5\textwidth-1em][l]{shortword} % just to have an indicator of the middle ...


0

Like this? \documentclass{article} \usepackage[T1]{fontenc} \newlength\mysep \setlength{\mysep}{20pt}% \newcommand\usemysep{\hspace*{\mysep}}% \newcommand\hangcenter[2]{% \begingroup \par \centering \makebox[0pt][r]{#1\usemysep}% \usemysep x\usemysep \makebox[0pt][l]{\usemysep #2}% \par \endgroup } \begin{document} Regular text. ...


2

Use \raisebox{-0.5\height}{...}, so the image will be vertically centered without any need to guess at its height. \documentclass{article} \usepackage{graphicx} \begin{document} \begin{figure}[htbp] \centering \raisebox{-.5\height}{% \includegraphics[width=0.7\textwidth]{example-image}% }\hfill {\footnotesize \begin{tabular}[c]{cc} \hline ...


2

\centering in LaTeX is obtained by setting \leftskip and \rightskip to infinitely stretchable glue (while, on the other hand, setting \parfillskip to zero). \leftskip and \rightskip specify glue that TeX should insert at the left, resp. right, of every line of a paragraph when the paragraph itself is broken into lines; since this happens when the \par token ...


0

I managed to set the alignment correctly. It was quite simple. I removed the \setkomavar{date}{...} and used \flushleft inside the Place variable: \setkomavar{place}{\flushleft Verona, Italy} The complete code is bellow: ...


2

You can define a centerlabel format in the following way: \documentclass{article} \usepackage{graphicx} \usepackage{caption} \DeclareCaptionFormat{centerlabel}{% \sbox0{#3}% \makebox[\linewidth]{\scshape#1#2}\\ \ifdim\wd0<\linewidth \makebox[\linewidth]{\unhbox0}% \else \unhbox0 \fi } ...


0

\documentclass{article} \usepackage[demo]{graphicx} \usepackage{caption} \DeclareCaptionFormat{center}{{\centerline{\textsc{#1}#2}\\}#3} \captionsetup{format=center,labelsep=none,justification=justified} \begin{document} \begin{figure} \centering \includegraphics[width=\textwidth]{} \caption{Lorem ipsum dolor sit amet, consectetur adipiscing ...


2

\centerline works: \documentclass{article} \usepackage[demo]{graphicx} \usepackage{caption} \DeclareCaptionFormat{center}{{\centerline{#1#2}\\}#3} \captionsetup{format=center,labelsep=none,justification=justified} \begin{document} \begin{figure} \centering \includegraphics[width=\textwidth]{} \caption{Lorem ipsum dolor sit amet, consectetur ...


0

Try this. I have removed the \\ used \hfil and \par in \DeclareCaptionFormat and added width in the \captionsetup Fullcode: \documentclass{article} \usepackage[demo]{graphicx} \usepackage{caption} %\DeclareCaptionLabelFormat{center}{{\centering #1 #2}} \DeclareCaptionFormat{center}{{\hfil\textsc{#1}#2\hfil}\par#3} ...


2

Something like this? Code: \documentclass{article} \usepackage{graphicx} \usepackage[active,floats,tightpage]{preview} \setlength\PreviewBorder{5mm} \begin{document} \begin{figure} \centering \raisebox{-13mm}{ \includegraphics[width=0.5\textwidth]{example-image} } \hfil ...


9

Let's start with an analysis of math atoms and spacings between them: & = \int The align environment adds an invisible empty subformula {} at the start of the column: {} = \int A subformula is acts as \mathord. The following line shows the math atoms with their type in the subscript position: {}ord =rel \intop There is a table in "The TeXbook" ...


6

An alternative approach would be to set the spacing based on the fact that = is a relation. Therefore, use \mathrel{\phantom{=}} (\hphantom is not really needed): \documentclass{article} \usepackage{amsmath} \begin{document} \begin{align} a & \mathrel{\hphantom{=}} \int \\ b & = \int \\ c & = F \end{align} \end{document}


1

Use \KOMAoption{refline}{dateleft} or \documentclass[ ... refline=dateleft% <- ]{scrlttr2} and remove your \setkomavar {date}{...}. Code: \documentclass[ foldmarks=false, fromrule=afteraddress, enlargefirstpage=on, fontsize=12pt, fromalign=center, %subject=left,% default parskip=full, backaddress=false, refline=dateleft ...


2

It's a choice of the package to have the last column aligned left and, as far as I can see, there's no provision for changing it by setting an option. You can change it by redefining the command \SYS@makesyspreamble@i that's responsible for setting the alignment in columns; the simplest way is to use regexpatch: \documentclass{article} ...


1

I guess you're looking for varwidth; remove \raggedright if it's not what you want for the text inside pcenter. \documentclass{report} \usepackage{varwidth} \usepackage{lipsum}% for context \newenvironment{pcenter} {\begin{center}\begin{varwidth}{\textwidth}\raggedright} {\end{varwidth}\end{center}} \begin{document} \chapter{chaptername} \lipsum[2] ...


2

Consider trying the makebook script, if you have access to bash: http://github.com/dgoodmaniii/makebook It has lots of options, and uses LaTeX and pdfpages behind the scenes (along with some utilities from the pdftk package). Disclaimer: I'm the author of makebook and am therefore biased about its usefulness. Something like the following should do what ...


4

Set geometry up with the dimensions of the final pages you want and create a PDF normally. Then create a second document and include the first PDF using pdfpages. This has options for creating the booklet with the format you want. So I use a5paper, twoside with geometry for my first document. Then I use twoside,a4paper and \usepackage{pdfpages} ...


1

If we redefine the \maketitlepage macro to always set the title page ragged right (instead of justified), it will improve the line wrapping. Add the following to the preamble of your document (between the \documentclass and \begin{document} lines): \renewcommand{\maketitlepage}{% \cleardoublepage \begin{fullwidth}% \sffamily \RaggedRight\sloppy% ...


2

You can think of the notation *{<num>}{<col-spec>} as a very simple 'repeater' or loop, if you will. Its only effect is that any valid set of column specifications <col-spec> will be placed literally <num> times into the tabulars preamble at the spot it's used. So something like \begin{tabular}{*{2}{c}} will become effectively ...


4

Use the S column type as intended: In your case, convert the column specification to \begin{tabular}{| l || S[table-format=7.0] | S[table-format=8.0] | S[table-format=8.0] |} The table-format key is already a special key. In these case you could define before hand \sisetup{table-figures-decimal} and than just use the table-figures-integer key with 7, 8 ...


0

Ok, here is complete example which should clarify may comment: \documentclass{article} \usepackage{tabularx} % definition of new column type should be in preamble of your document \newcolumntype{C}{>{\centering\arraybackslash}X} \begin{document} \begin{table}%[H] if possible, avoid to use ``[H] % option for placing of table, better is ...


3

Nice version \documentclass{article} \usepackage{array} \usepackage{booktabs} \usepackage{caption} \usepackage{siunitx} \begin{document} \begin{table} \centering \caption{Table example} \begin{tabular}{ S[table-format=4.2] S[table-format=3.2] } \toprule \textbf{Number} & \textbf{Probability} (\si{\percent}) \\ \midrule 0 & 100 \\ ...


2

If I modify your example so it can be run using general images \documentclass[standard]{letter} \usepackage[usestackEOL]{stackengine} \stackMath \usepackage{graphicx} \def\imgi{} \begin{document} \begin{center} \stackinset{l}{ .1in}{b}{.2in}{}{% \stackinset{r}{ .2in}{t}{.3in}{\includegraphics[width=4.5in]{example-image-a}}{% ...


4

Notwithstanding the question of whether protrusion may be pointless with ragged text, my patch you referred to is simply incomplete. You also need to add the following: \def\@vwid@measure{% \ifvoid\z@ \else % numbered equations not part of alignments can't be reset, % so force retention of full width. \ifnum\count@=\@vwid@postnump ...


4

The lstlisting package only boxes the contents if it starts in horizontal mode (which is the reason why it boxes the contents in a tabular). A solution is to coerce horizontal mode, but there's the added problem of setting the caption, which can be done with the help of \captionof, persuading LaTeX into thinking this is a listings and not a figure. In ...


0

Please ignore this answer if you want a pure LaTeX solution [Dangerous bend sign] Since this site mainly concentrates on LaTeX and the AMS math environments, I hesitate to offer a plain TeX solution, but in this case you can get the flexibility you want with a fairly simple alignment. It's all explained in Chapter 22 of the TeXBook. \noindent Plain ...


0

I'd place the entire construction inside an flalign rather than break them apart: \documentclass{article} \usepackage{amsmath} \begin{document} \begin{flalign*} \textbf{Theorem 4: } \mathrm{E}[XY] &= \mathrm{E}[X]\mathrm{E}[Y] & \\ \makebox[0pt][l]{\bfseries Proof: }\hphantom{\textbf{Theorem 4: }} \mathrm{E}[XY] &= \sum_j\sum_i (x_i ...


0

If you persist to use unusual way to wrote theorems, proofs, lemmas ... than with flaling you can obtain: \documentclass{article} \usepackage{empheq} \usepackage[active,tightpage]{preview}% for showing equations only \PreviewEnvironment{flalign*} \setlength\PreviewBorder{1em} \begin{document} \begin{flalign*} \textbf{Theorem 4:} && ...


6

Unwanted space at the right side The first issue is just a unwanted space by a line end: \centerline{% \begin{tikzpicture}...\end{tikzpicture} } Then the tikzpicture with width \paperwidth plus the space after \end{tikzpicture} is centered, leaving the half of the space at the right side of the paper. Solution: \centerline{% ...


1

or by using tabularx: \documentclass{article} \usepackage{tabularx} \usepackage[framemethod=TikZ]{mdframed} \usetikzlibrary{shadows} \newmdenv[shadow=true,shadowcolor=black,font=\sffamily, align=right, leftmargin=10pt]{shadowbox} \usepackage[active,tightpage]{preview} \PreviewEnvironment{shadowbox}% <-- just for showing only the shadowbox ...


3

After \newline spacing such as \hspace is ignored; you can force it to work with \hpsace* instead. Try this little example to see what happens: \noindent Text\newline \hspace{2cm}text\newline \hspace*{2cm}text. However, what you probably want is a tabbing environment, otherwise the columns are not going to line up. Compare the first example below with ...


3

I'm not sure why the flalign environment seems to have become very fashionable. Here are two solutions, based on the alignedat inner environment. Inside the equation* or flalign* environment (if you really want left alignment) I define a local abbreviation for the labels. If you have several of these constructions, move the command in the preamble, so ...


3

You cannot go to a newline arbitrarily in a tabular environment, unless you use tabularx. However, there is luckily a package just to fill this gap, which is makecell. You can also change the font style (bold, italics) so it's very handy. Concerning the centering of the cells, you can create a new column type, but you need to load the array package. I also ...


2

This gets (like some other answers) the proper math spacing and (unlike the other answers), gets the proper (right) alignment on the numbers, using tabular stacks. \documentclass{article} \usepackage{tabstackengine} \stackMath \setstacktabulargap{0pt} \begin{document} \[ \tabularCenterstack{rrcr}{ \textit{Angle}: & -45^{\circ} \le& \theta ...


1

Note the fl in flalign is for full length, not flush left. the fleqn option is intended to flush left math layouts: \documentclass[fleqn]{article} \usepackage{amsmath} \setlength\mathindent{0pt} \begin{document} left aligned equation: \begin{align*} {\begin{array}{c} \text{Something long}\\ {[\text{Something}_{\text{else}}]} \end{array}} &= ...


5

I'd suggest using siunitx (and booktabs for better horizontal rules). \documentclass{beamer} \usepackage[T1]{fontenc} \usepackage[utf8]{inputenc} \usepackage{siunitx,booktabs} \begin{document} \begin{frame}{title} \begin{center} \addtolength{\tabcolsep}{-2pt} % or it would be overfull \begin{tabular}{ l ...


2

One way is to wrote headers in \multicolumn{1}{c}{<header text>}: \documentclass{beamer} \usepackage{dcolumn} \newcolumntype{d}[1]{D{.}{.}{#1}} \begin{document} \begin{frame}{title} \begin{table}[H] \centering \begin{tabular}{|l|d{4.6}|c|c|} % I just did it for one to see the result \hline \multicolumn{1}{c}{\textbf{Poste}} & ...


11

I would use alignat for multiple alignments. \documentclass{article} \usepackage{amsmath} \begin{document} \begin{alignat*}{2} \textit{Angle}: &\ & -45^{\circ} &\le \theta \le +45^{\circ} \\ \textit{Bins}: &\ & -135^{\circ} &< \theta < -45^{\circ} \\ \textit{Slant}: &\ & +45^{\circ} ...


4

You could use tabular or array instead of flalign*: \documentclass{article} \usepackage{array,amsmath} \begin{document} \begin{tabular}{r>{$}r<{$}*{4}{>{$}l<{$}}} \textit{Angle}: & -45^{\circ} & \le & \theta & \le & +45^{\circ} \\ \textit{Bins}: & -135^{\circ} & < & \theta & < & ...


4

Try: \begin{flalign*} \textit{Angle}: && -45^{\circ} &\le \theta \le +45^{\circ} \\ \textit{Bins}: && -135^{\circ} &< \theta < -45^{\circ} \\ \textit{Slant}: && +45^{\circ} &< \theta < +135^{\circ} \\ \textit{Tilt}: && -180^{\circ} &\le \theta \le -135^{\circ} \ or\ ...


5

The difference is in the fact that beamer redefines itemize to have an optional argument, which isn't done for enumerate. Thus your attempt to patch \itemize adds the code in the wrong place. With xpatch it works: \documentclass{beamer} \usepackage{tikz} \usepackage{xpatch} \usepackage{polyglossia} \setdefaultlanguage[numerals=maghrib]{arabic} ...


1

Here's a solution that uses an array environment to align the various terms. \documentclass{article} \usepackage{amsmath,array} \begin{document} \[ \setlength\arraycolsep{0pt} \begin{array}{c @{} >{{}}c<{{}} c >{{}}c<{{}} l @{{}={}} c @{} >{{}}c<{{}} l} \mathrm{B} & + & \mathrm{R} & \cdot & \mathrm{t}_1 & ...


2

One way to align the content as desired is to use a \makebox to center the text in the desired amount of space: Notes: I would highly recommend you use the siunitx package as well for typesetting anything with units. Code: \documentclass{article} \usepackage{mathtools} \usepackage{siunitx} \sisetup{output-decimal-marker={,}} ...


4

Just to show the caption's way. You can use \captionsetup inside the table environment, making the effect local. You have to use \captionsetup{justification=raggedright}. If you want hyphenation inside the captions, use RaggedRight and this needs \usepackage{ragged2e} \documentclass{article} \usepackage{caption} \begin{document} \begin{table} % This ...


2

Just issue a \raggedright within the \caption in question: \documentclass{article} \begin{document} \begin{table} % This caption will be \raggedright. \caption[First caption]{\raggedright Lorem ipsum dolor sit amet, consectetur adipiscing elit. Phasellus ac magna eu risus consectetur fringilla vitae at mi. Suspendisse nunc massa, maximus sit amet ...


1

An alternative possibility with tikz-cd: \documentclass{article} \usepackage{amsmath,amssymb} \usepackage{tikz-cd} \newcommand{\numberset}[1]{\mathbb{#1}} \newcommand{\R}{\numberset{R}} \DeclareMathOperator{\im}{Im} % \Im is preempted \DeclareMathOperator{\su}{\mathfrak{su}} \DeclareMathOperator{\so}{\mathfrak{so}} \begin{document} \begin{equation} ...


3

How about using an array: \documentclass{article} \usepackage{amsmath,amsfonts} \begin{document} \[ \begin{array}{r*{7}{c}l} (\text{Im} H, [,]) & \rightarrow & \mathfrak{su}(2) & \rightarrow & \mathfrak{so}(3) & \rightarrow & \mathbb{R}^3 & \rightarrow & (\text{Im} H, \cdot) \\ i & \mapsto & ...


3

You need to use more alignment operators & since the traditional output around these follow a Right-Left alignment: \documentclass{article} \usepackage{amsmath} \begin{document} \begin{alignat*}{3} &\tfrac{1}{2} \log(\langle d_x, d_x \rangle + \tfrac{1}{2} \log(\langle d_y, d_y \rangle - \log(\langle d_x, d_y \rangle) &&> 0 \quad| ...



Top 50 recent answers are included