Tag Info

New answers tagged

4

This is a very dirty trick, but it works. It aligns the matrices' elements rather than the delimiters. \documentclass[11pt,a4paper,oneside]{report} \usepackage[pdftex]{graphicx} \usepackage[T1]{fontenc} \usepackage{fouriernc} \usepackage{mathtools} \usepackage{amsfonts,amsmath,amssymb,amsthm} \usepackage[a4paper, hmargin={3.5cm,3cm}, ...


1

There you go again: \documentclass{book} \usepackage{mathtools,amssymb,ifoddpage,showframe} %% remove showframe. \usepackage{xcolor} \definecolor{background}{RGB}{255,255,170} \usepackage{empheq} \newcommand*\mybox[1]{% \colorbox{background}{\hspace{1em}#1\hspace{1em}}} \usepackage{kantlipsum} \usepackage[fulladjust]{marginnote} ...


1

Put \resizebox inside the minipage environment. Actually, the minipage can be removed in such case, when double check and also found by @Mico. thanks. Code \documentclass{article} \usepackage[showframe]{geometry} \usepackage{booktabs} \usepackage{multirow} \usepackage{amsmath} \usepackage{graphicx} \begin{document} \noindent \begin{table}[htbp] ...


2

You have better ways of colouring an equation. See for example: this question and its answers. I have used empheq in my example. With tcolorbox, you can be more fancier. Now the real problem. The following code works with the help of marginnote package. \documentclass{book} \usepackage{mathtools} \usepackage{xcolor} ...


4

The interesting thing is that \tempa gets set to zero at some point and has to be recomputed. \documentclass{standalone} \usepackage{mathtools} \newlength{\tempa} \newcommand{\aligncenter}[1]% #1=display math to be aligned {\settowidth{\tempa}{$\displaystyle #1$}% \hspace{0.5\tempa}&% \settowidth{\tempa}{$\displaystyle #1$}% \hspace{-0.5\tempa}#1} ...


1

You can achieve that with the \mathclap command. As I don't see what the minipage environment is here for, I deleted it. \documentclass{article} \usepackage{mathtools} \usepackage{nccmath} \begin{document} \begin{align*} & \prod_{\mathclap{k = -n}}^{\mathclap{n-1}}\; \biggl[\frac{k+1}{k}\biggr] = -1 \\ & \prod_{\mathclap{j = 1}}^{n} j = ...


4

In this specific case one sub-optimal option would be to use \smashoperator[l]: \documentclass{article} \usepackage{mathtools}% Loads amsmath \begin{document} \begin{align*} & \smashoperator[l]{\prod_{-n \leq k \leq n-1}}\left[\frac{k+1}{k}\right] = -1 \\ & \smashoperator[l]{\prod_{1 \leq j \leq n}} j = \lim_{m\to\infty} \frac{m^{n+1} ...


3

ragged2e updates both \newline and \\ to function differently. Before updating, it stores the original set of macros. The original functionality can be reinstated by placing \makeatletter \let\@gnewline\@raggedtwoe@saved@gnewline% Restore original functionality of \newline \let\\\@raggedtwoe@savedcr% Restore original functionality of \\ \makeatother in ...


6

Put & before the text, not after. I also modified text subscripts (red, sp) as text, and removed \limits (redundant in this environment) in the first equation: \documentclass[ngerman]{scrartcl} \usepackage[utf8]{inputenc} \usepackage[T1]{fontenc} \usepackage{babel} \usepackage{amsmath} \usepackage{amsfonts} \usepackage{amssymb} \usepackage[showframe, ...


2

1ST APPROACH This page checks the page number for even/odd, to decide whether to left or right lap the chapter number. The distance from the outside edge of the chapter number to the edge of the page is preserved in this approach. \documentclass[letterpaper,twoside,openright]{memoir} \usepackage{blindtext} \usepackage{graphicx} \usepackage{etoolbox} ...


2

fancyvrb provides xleftmargin and xrightmargin as key-value settings to adjust the left/right margins of the verbatim text: \documentclass{article} \usepackage{fancyvrb} \begin{document} \begin{enumerate} \item First item \begin{enumerate} \item First sub-item \begin{Verbatim}[fontsize=\tiny,xleftmargin=-5cm] This line of code is nice ...


4

Verbatim is a list and uses as leftmargin \@totalleftmargin. So you can change this locally: \documentclass{article} \usepackage{fancyvrb} \begin{document} \begin{enumerate} \item First item \begin{enumerate} \item First sub-item \begingroup \makeatletter \@totalleftmargin=-1cm \begin{Verbatim}[fontsize=\tiny] This line of code is nice and ...


4

Here's a solution with the verbatimbox package. Note that this first solution will not break the verbatim across page boundaries. \documentclass{article} \usepackage{verbatimbox} \begin{document} \begin{enumerate} \item First item \begin{enumerate} \item First sub-item \hspace{-5cm}\begin{verbbox}[\tiny] This line of code is nice and ...


2

The code could be written as shown below \documentclass{article} \usepackage[pdftex]{graphicx} \usepackage[T1]{fontenc} \usepackage{fouriernc} \usepackage{amsmath} \usepackage{amsthm} \usepackage{amsfonts} \usepackage{amssymb} \begin{document} \begin{align*} \omega_{1}^2&=1-2\sqrt[3]{19}+\sqrt[3]{19^2}\\ ...


5

\documentclass{article} \usepackage[T1]{fontenc} \usepackage{fouriernc} \usepackage{mathtools} \usepackage{amsthm} \usepackage{amsfonts} \usepackage{amssymb} \begin{document} \begin{align*} \omega_{1}^2&=1-2\sqrt[3]{19}+\sqrt[3]{19^2}\\ \omega_{1}^{2}&=b\omega_{1}+a\omega_{2}+r\\ a=3, & \qquad b=-3, \qquad r=-3 \\ ...


0

You probably just need to load amsmath, as in the second line below: \documentclass{article} \usepackage{amsmath} \begin{document} \begin{equation}\label{eq:sinuramp} I(x)= \begin{cases} s(x) & \text{if $x \le L/n$,} \\ s'(L/n)*x - s'(L/n)*L/n+s(L/n) &\text{if $x>L/2$.} \end{cases} \end{equation} \end{document}


1

By default, matlab2tikz produces the code that enable scale only axis option of the axis environment (see 4.10.1 Common Scaling Options of the pgfplots documentation). Just remove that line from your .tikz file to solve the first issue. The second problem is more about your personal representation of the data, so I may only suggest to reduce the font or ...


0

I want to ask a question to egreg's answer. You answer is actually correct, but the vertical space between Foo and Hello everyone is increased. Do you have any way to solve this situation? Thanks


3

Or use a makebox: \documentclass[10pt]{beamer} \begin{document} \begin{frame} \centering \includegraphics[width=0.6\textwidth]{example-image}\\ \makebox[0.6\textwidth][r]{\url{http://xkcd.com/1301}} \end{frame} \end{document} Or \llap and \raisebox \documentclass[10pt]{beamer} \begin{document} \begin{frame} \centering ...


2

...or use a right-aligned stack \documentclass[10pt]{beamer} \usepackage{graphicx} \usepackage{url,stackengine} \begin{document} \begin{frame} \begin{center} \def\stackalignment{r}\stackunder[6pt]{% \includegraphics[width=0.6\textwidth]{example-image}% }{% \url{http://xkcd.com/1301}% } \end{center} \end{frame} \end{document} ...


9

Or use a minipage \documentclass{beamer} \begin{document} \begin{frame} \begin{center} \begin{minipage}{0.6\textwidth} \includegraphics[width=\linewidth]{example-image} \\ \raggedleft\url{http://xkcd.com/1301} \end{minipage} \end{center} \end{frame} \end{document}


6

Use a tabular \documentclass{beamer} \begin{document} \begin{frame} \begin{center} \begin{tabular}{@{}r@{}} \includegraphics[width=0.6\textwidth]{example-image} \\ \url{http://xkcd.com/1301} \end{tabular} \end{center} \end{frame} \end{document}


0

Your minor problems can be solved First Problem: use ~{} before and after ; Second Problem: use \begin{tabular*}{0.95\textwidth}{@{\extracolsep{\fill}}rrrrrcc} and adjust the numbers in brackets with ~{} as shown in the code Third problem: minus sign is accepted. no error message was thrown code \documentclass{article} \usepackage{booktabs} ...


2

With package mathtools: \documentclass[11pt]{article} \usepackage{mathtools} \usepackage{array} \usepackage[math]{cellspace} \begin{document} \begin{table}[!htdp] \begin{center} \begin{tabular}{Sc @{\clap{0}} m{5cm} @{$\mathclap{c}$} m{5cm} @{$\mathclap{r}$}} \cline{2-3} \multicolumn{1}{c}{$\dfrac{1}{x}$} & \multicolumn{1}{|c}{F} & ...


1

With tabularx: \documentclass[11pt]{article} \usepackage{amsmath} %% showframe just for demo \usepackage{tabularx} \usepackage[table]{xcolor} \begin{document} \noindent\arrayrulewidth1pt \begin{tabularx}{\textwidth}{>{\hsize=0.05\hsize}XXX} \cline{2-3} \noalign{\vspace{\arrayrulewidth}} \raggedleft$\dfrac{1}{x}$ & ...


1

I figured out how to do it with a graphics package. Still interested if there's a way with tables. \documentclass[11pt]{article} \usepackage{array} \usepackage[math]{cellspace} \usepackage{tikz} \definecolor{fillcolour}{HTML}{eeeeee} \begin{document} \begin{tikzpicture} \draw (5,0) -- (5,1); \draw (0,0) rectangle (10,1); \draw [fill=fillcolour] (0,0) ...


1

Is this what you seek? Use of text width=the longest length and align=left,center, right of your selections. Code \documentclass[border=10pt]{standalone}%[12pt,twoside,a4paper]{book} \usepackage{graphicx,wrapfig,tikz} \usetikzlibrary{positioning,shapes} \tikzset{myarrow/.pic = { \begin{scope}[rotate=-90,scale=0.5] \draw[fill=black] (-0.5,0) -- ...


2

For your first problem, it's because inside each cell we're in math mode. For the second problem, I think it would be better-looking to have the confidence intervals centred in the cell; to have the semi-colon centred between numbers, I replaced it with `{\,;\,}. I do not meet the third problem with the code you give. I also propose to put the legend at ...


2

One way to solve issues #1 and #2 is to center-set the confidence intervals below the corresponding point estimates, by encasing the intervals in pairs of curly braces, {...}. You can probably solve issue #3 by removing - (the minus symbol) from the list of "input symbols" defined in \sisetup{...}. However, since there's not a single - symbol in the table ...


5

Unless you use TiKZ for some other reason. There is no need to use it to obtain your diagram. With help from "The Comprehensive LaTeX symbols list" (for \xrightarrow and \xmapsto) and egreg's answer to Make box with minimum width (in math mode) (for \minwidthbox) is possible to write: \documentclass{article} \usepackage{amsmath,amssymb,empheq,mathtools} ...


1

Either you use the fleqn option in your document class, but then all equations will be left-aligned, or you have to use the flalign* environment: \documentclass[10pt]{article} \usepackage[showframe, nomarginpar]{geometry} \usepackage{amsmath} \DeclareMathOperator{\sgn}{sgn} \begin{document} \begin{flalign*} & ...


3

You could also define an \Arrow command of fixed width and variable style and let the \matrix manage the alignment and column widths instead of doing it manually: \documentclass{article} \usepackage{tikz} \usetikzlibrary{matrix, arrows} \usepackage{amssymb} \newcommand{\Arrow}[2][->]{% \tikz[baseline=-0.7ex, x=2cm, #1] \path (0,0) edge node ...


3

Thanks to @percusse for pointing me in the right direction to find the solution. Styling column by column is a solution to this problem (altought not as elegant as I expected). The point is to modify each column definition to obtain what I want, so for example column 2/.style={nodes={text width=1.5cm, align=center}} The final code is the following ...


4

You need to make (at least) the following changes: If you want the minipages to be placed one below the other rather than side-by-side, remove the \hfill instruction and simply leave a blank line If you want the captions to occupy the full width of the textblock, don't restrict the minipage widths to 0.48\linewidth. Instead, set their widths to ...


1

I know this has been solved for a while, but can't you just use OP's second solution with \displaystyle? \[ \begin{array}{rcccl} \displaystyle\sum a &\le& \displaystyle\sum b &\le& \displaystyle\sum c \\ \displaystyle\log \sum a &\le& \displaystyle\log \sum b &\le& \displaystyle\log \sum c \end{array} \]


1

Beware of spaces at the end of lines between environments/commands! The hint is that you have a comment character at the end of your first subfigure. If you change all of these lines so that they look like \end{subfigure}% Then all is well:


1

It is well known that any TeX typesetting engine refrains from breaking lines while in math mode; when it does this takes place before a \relation operator. In your simple exression $\exists x.p(x)$ there are no breakpoints suitable for any typesetting engine; manually dividing after \exists would not be typegraphically and mathematically correct. What you ...


4

You can define \myparagraph like this: \usepackage{calc} %% provides `\widthof` macro \newlength{\mylen} \newlength{\mylength} \newcommand{\myparagraph}[2][]{% \setlength{\mylen}{\widthof{\textbf{#2}}} \setlength{\mylength}{\dimexpr\mylen+1em\relax} \paragraph[#1]{#2} \hangindent=\mylength } And then use \myparagraph{Title} whenever you want hanging. ...


2

Here's a solution that uses the dcolumn package and its d column type instead of the siunitx package and its S column type. The main advantage I see to using the dcolumn package is that it simplifies setting the single, double and triple asterisks in superscript position; doing so is not only stylistically pleasant but also serves to economize on much-needed ...


1

The “official” way of doing this is \documentclass{article} \usepackage{mathtools} \begin{document} \begin{align} f(1) &= 1 \\ f(2) &= 2 \\ &\vdotswithin{=} \nonumber \\ f(n) &= n f(n-1) xxxxxxx \end{align} \end{document} But this doesn't answer the question, though. So… why would you like \vdots that ignore the content of ...


2

Like this? \documentclass{article} \usepackage{mathtools} \begin{document} \noindent X\hrulefill X \begin{align} f(1) &= 1 \\ f(2) &= 2 \\ \shortintertext{\hfil \vdots \hfil} f(n) &= n f(n-1) xxxxxxx \end{align} \end{document}


3

Here is a solution, which simply consists re-defining the X column type. I didn't use your colours (hkvcyan, hkvred) as I don't know what they are, and I had to prune your code, as a lot has nothing to see with your problem. \documentclass{article} \usepackage[utf8]{inputenc} \usepackage{fourier} \usepackage{heuristica} \usepackage{cabin} ...


5

You are padding too much data in the table. Anyway, here is an attempt. \documentclass{article} \usepackage{booktabs,multirow} \usepackage{siunitx} \sisetup{detect-mode, group-digits = false, input-symbols = ( ) } \newcommand{\level}[1]{% \multirow{2}{*}{% \begin{tabular}{@{}>{\raggedright\arraybackslash}p{0.2\textwidth}@{}} ...


0

Here is another solution: \documentclass[a4paper]{book} \usepackage[T1]{fontenc} \usepackage{caption} \usepackage{fancyvrb} \usepackage{listings} \begin{document} \begin{figure} \centering \lstset{xleftmargin=0.18\textwidth,xrightmargin=0.18\textwidth} \begin{lstlisting} trait Sys[S <: Sys[S]] { type Tx <: stm.Txn[S] type Var[A] <: ...


5

Set the main geometry first and then use \newgeometry for the title page; fancyhdr sets the dimensions of headers and footers according to the current geometry values. \documentclass[12pt]{article} \usepackage{geometry} \geometry{letterpaper,textwidth=7in,textheight=9.5in} \usepackage{fancyhdr} \pagestyle{fancy} \fancyhf{} ...


1

(Too long for a comment, hence posted as an answer.) An observation up front: Given that your bibliographic entries have doi and url fields, you should consider using the unsrtnat bibliography style along with the natbib citation management package; the venerable unsrt style simply ignores those fields. If you load natbib with the option numbers, you ...


1

First of all, you have to center each tikzpicture inside each subfigure. You achieve that with \centering just to the left of the \begin{tikzpicture}. Also, giving every subfigure the same width (0.16\textwidth) is a good deal. To have every subfigure in the same line, you should probably play with document margin, because with six figures you are very ...


2

If you're sticking to a single-line \KwInput, you can use the following: \documentclass[a4paper]{article} \usepackage[ruled]{algorithm2e} \usepackage{calc} % Define keywords \SetKwInput{KwInput}{Input} \SetKwInput{KwOutput}{Output} \let\oldKwInput\KwInput \renewcommand{\KwInput}[1]{% \makebox[\widthof{\KwOutput{}}][l]{\oldKwInput{}#1}% } ...


1

Here's an unusual way to achieve it... using tabular. \documentclass[a4paper]{article} \usepackage[ruled]{algorithm2e} % Define keywords \SetKwInput{KwInput}{Input} \SetKwInput{KwOutput}{Output} % This aligns the colons %\SetKwInOut{KwInput}{Input} %\SetKwInOut{KwOutput}{Output} \begin{document} \begin{algorithm}[h] \tabcolsep=0pt ...


2

\documentclass[a4paper]{article} \usepackage[ruled]{algorithm2e} \usepackage{etoolbox} \makeatletter \renewcommand{\SetKwInOut}[2]{% \sbox\algocf@inoutbox{\KwSty{#2}\algocf@typo:}% \expandafter\ifx\csname InOutSizeDefined\endcsname\relax% if first time used \newcommand\InOutSizeDefined{}\setlength{\inoutsize}{\wd\algocf@inoutbox}% ...



Top 50 recent answers are included