Tag Info

New answers tagged

2

Issuing \sloppy in your preamble may allow for a more breathable flow of text in some cases, but also avoid* overfull boxes - typically the case when text overflows the text block/column margins. Fundamentally \sloppy gives an "emergency stretch" of 3em, which should be plenty of space to have a word break at a "more appropriate" syllable. * source2e (p ...


0

This doesn't have anything to do with quotchap. Instead, it's about expanded macros making their way into the ToC where they don't belong. Specifically \leftline... Having said that, it's easier in this case to let them migrate into the ToC, but just make them do nothing when you call \tableofcontents. Here's an example of this: \documentclass{book} ...


3

In your example, you start a group with a { immediately before \centering, but this group is never terminated with a }. Thus \centering stays in effect for the remainder of the document, and you get some complaints (but not errors) from TeX in the log: (\end occurred inside a group at level 1) ### simple group (level 1) entered at line 60 ({) ### bottom ...


1

Your formulae are on left margin. To have them (more) centred, you should add a pair of && in front of them. If you want them to be really centred, you can use the alignat* environment: \documentclass[a4paper]{article} \usepackage[utf8]{inputenc} \usepackage{mathtools} \usepackage{nccmath} \usepackage[margin=1in, showframe]{geometry} ...


2

Use of parbox[length]{content} is another option. Code \documentclass[a4paper]{article} \usepackage{mathtools} \usepackage{nccmath} \usepackage[margin=1in]{geometry} \newcommand \widebox[1]{\setlength\fboxsep{6pt}\boxed {\enspace#1\enspace}} \newcommand \dpartial[2]{\frac{\partial #1}{\partial #2}} \newcommand \ddef[2]{\frac{d #1}{d #2}} \newcommand ...


5

Set the item in a tabular: \documentclass[a4paper]{article} \usepackage{mathtools} \usepackage{nccmath} \usepackage[margin=1in]{geometry} \newcommand \widebox[1]{\setlength\fboxsep{6pt}\boxed {\enspace#1\enspace}} \newcommand \dpartial[2]{\frac{\partial #1}{\partial #2}} \newcommand \ddef[2]{\frac{d #1}{d #2}} \newcommand \spac{\\[0.6em]} ...


1

It's never a good idea to use two consecutive display math environments with nothing in between (because the spacing will be wrong). Using align, the alignment characters can go before the beginning of the bmatrix environments. \documentclass{article} \usepackage{amsmath} \begin{document} \begin{align} &\begin{bmatrix} -1 & 0 & -1 ...


2

Since this is basically a table, I would use a tabular* with a \fill between the columns. That way, the table will be flush with the left and right margins of the text, which is what the OP seemed to desire. \documentclass{article} \usepackage{amsmath} \def\boldcal#1{\ooalign{$\mathcal{#1}$\cr\kern.3pt$\mathcal{#1}$}} \begin{document} {\centering FINAL ...


1

Or you can use the flalign* environment provided by the amsmath package: \documentclass{article} \usepackage{amsmath} \usepackage[per-mode=symbol]{siunitx} \usepackage[english]{babel} \usepackage{blindtext}% dummy text \begin{document} \begin{flalign*} &c=\frac1{\sqrt{\epsilon_0\mu_0}}=\SI{3e8}{\m\per\s} &&\text{speed of light}\\ ...


3

I would just use align inside the amsmath package. By putting the & on the LHS you can left-align your equations. For example, the first three rows of your table are: \documentclass{article} \usepackage{amsmath} \begin{document} \begin{align*} &c=\frac1{\sqrt{\epsilon_0\mu_0}}=3\times 10^8 m/s &&\text{speed of light}\\ ...


5

You have \textwidth wide minipages; however, in cases like these, it's better to use threeparttable, so the caption will be properly centered over the table. \documentclass{article} \usepackage{fullpage} \usepackage{threeparttable} \begin{document} \begin{table}[htbp]\centering \def\sym#1{\ifmmode^{#1}\else\(^{#1}\)\fi} \begin{minipage}{.45\textwidth} ...


5

Use \begin{minipage}{0.49\textwidth} ... \end{[minipage}\hfill \begin{minipage}{0.49\textwidth} ... \end{[minipage} It must be less or equal to the current line width. But you had both with \textwidth


1

Edit There may well be a better way of doing this but here's a solution using tikz. It turns out be easier to anchor the nodes at the south west corner. \documentclass{article} \usepackage{tikz} \usepackage{lipsum} \begin{document} \begin{tikzpicture}[scale=\textwidth/15.2cm, every node/.style={anchor=south west, rectangle,rounded ...


2

The makecell package can be handy here, as it allows to have a common formatting for all coumn headers declared in preamble. It also defines a command for hlines of varying thickness. Consider also using the booktabs package: \documentclass{article} \usepackage[utf8]{inputenc} \usepackage[x11names]{xcolor} \usepackage{array, booktabs} ...


2

Taken from Herbert's another answer (click) several decades ago and I modified to meet my requirement. But honestly I am not sure whether or not it is safe for long-term use. \documentclass[dvipsnames,border=12pt,preview]{standalone} \usepackage{xcolor} \usepackage{showexpl} \usepackage{accsupp} ...


2

try ... \makeatletter \let\SX@I\SX@resultInput \def\SX@resultInput{\centerline{\SX@I}} \makeatother \begin{document} \LTXinputExample[pos=t,style=PSTricks,graphic={[scale=1]"diagram"}]{diagram.tex} \end{document}


4

You can try with align key of enumitem and define your own align key: \SetLabelAlign{myright}{strut\smash{\parbox[t]{\labelwidth}{\raggedleft#1}}} and use it as align=myright. \documentclass{article} \usepackage{enumitem,showframe} \SetLabelAlign{myright}{strut\smash{\parbox[t]{\labelwidth}{\raggedleft#1}}} \newlist{keywordlist}{description}{1} ...


0

If you don't like using subfigure, then use "caption" and "subcaption": \usepackage{caption} \usepackage{subcaption} \begin{document} \begin{figure} \centering \begin{subfigure}[t]{0.4\columnwidth} \centering \includegraphics[width=\columnwidth, keepaspectratio] {frog.jpg} \caption{Subfigure 1 ...


0

For putting figures side by side you can try this one (everything is handled automatically and you may use more or less number of figures: 2, 3, 4, etc.): \usepackage{graphicx} \usepackage{subfigure} \begin{document} \begin{figure}[ht] \centering \subfigure[Subfigure 1 title]{ \rule{2.8cm}{2cm} \label{fig:subfig1} } \subfigure[Subfigure 2 title]{ ...


1

I suggest using the empheq package for a simpler syntax, with option overload. It loads mathtools, which in turn loadsamsmath. I also usenccmath` for its mediumsized fractions, that look better here, in my opinion: \documentclass{article} \usepackage[overload]{empheq} \usepackage{nccmath} \begin{document} \begin{align*}[left = \empheqlbrace] a^{3} + ...


2

When I tried using cases, it aligned nicely and worked just fine: \[ \begin{cases} a^3+b^3 &= -q \\ ab &= -\dfrac{1}{3}\,p. \end{cases} \] If that isn't an answer and you really are stuck with using the array, you might try to change the column separator to an equals sign with a bit of space around it, and then put @{} before the ...


3

I would use aligned rather than array here, because semantically it's not really a cases situation nor an array: \documentclass{article} \usepackage{amsmath} \begin{document} \begin{equation*} \left\{ \begin{aligned} a^{3} + b^{3} &= -q \\ ab &= \dfrac{-1}{3} \, p \end{aligned} \right. \end{equation*} \end{document}


1

The column separation specification @{<stuff>} inserts <stuff> between the columns, so the result is as expected in your case. If you want a 2.5pt gap, then you need to insert @{\hspace{2.5pt}}. However, if your main aim is to align the parts at the = sign, then you can use \documentclass{article} \usepackage{amsmath} \begin{document} ...


5

I'm more going towards what you're after than what you currently have... Specifying a fixed distance between columns is best done using the @{..} specification. So, for example, one could use l@{\hspace{1cm}}c to denote a 1cm gap between a left and centred column. \documentclass{article} \usepackage{booktabs}% http://ctan.org/pkg/booktabs ...


0

Tabular adjusts column widths automatically to cell contents. It doesn't have enough information to equally space the st1 and st2 columns relative to the multicolumn header. It fits st1, then adjusts st2 to fit the rest of the multicolumn header. Your example does not work for single word headings. Remove the space between abcdefg and fewfewfe to see the ...


0

Because the caption (abcdefg fewfewfe) is wider than the columns the last column is widened. Below is one solution, which you may or may not like. \documentclass{article} \usepackage{minibox} \begin{document} \begin{table}[!t] % increase table row spacing, adjust to taste \renewcommand{\arraystretch}{1.3} \caption{An Example of a Table} ...


2

Change the definition of \paragraph so that it is like \subsubsection and not an inline title. \documentclass[11pt,a4paper]{article} \makeatletter \renewcommand\paragraph{% \@startsection{paragraph}{4}{\z@}% {-3.25ex \@plus-1ex \@minus-.2ex}% the same spacing above, but negative {1sp}% no space after the title ...


2

Pass the align=center option to the nodes. I also changed to a matrix of math nodes to have the proper math-mode for the math expressions (regular text was produced with the help of \text from amsmath) and increased the text width: \documentclass[a4paper,fontsize=12pt,a4paper,DIV=10,BCOR=10mm,twoside,titlepage=false,openany,pagesize]{scrbook} ...


4

Replication of column specifications is done using a *{<num>}{<col spec>} interface, which should repeat <col spec> a total of <num> times: \begin{tabular}{*{20}{c}} % tabular content \end{tabular} will produce a table of 20 columns, each one centred. To add vertical column rules (which you should never do), you can use ...


3

\centering is a switch that causes everything inside the group following it to be centred. Remove it since you don't need it in this context - it is the cause of the alignment problem in your section title. Moving the list environment to the right could be done using enumitem's leftmargin or wide key-value. \documentclass[12pt]{article} ...


6

Use \centering inside the figure environment. \documentclass[10.5pt]{beamer} \usepackage{beamerthemesplit} \usetheme{Copenhagen} \setbeamercovered{transparent} \usepackage{ragged2e} \let\olditem=\item% \renewcommand{\item}{\olditem \justifying} \begin{document} \begin{frame} \begin{itemize} \item blablabla \begin{figure} \centering ...


1

You could simply not use the \text{...} "wrapper" in the second argument of \DeclareMathOperator*} macro. Instead, just write \newcommand\myspacer{\quad} \DeclareMathOperator*{\minimize}{minimize\myspacer} \DeclareMathOperator*{\subjto}{subject\ to\myspacer} The macro \myspacer is set to \quad for now. If you wish to change it to \qquad or \, that's ...


4

You can set the problem in an array to adjust the spacing. For consistency, it's best to define this as an environment: \documentclass{article} \usepackage{amsmath,array,environ} \DeclareMathOperator*{\minimize}{\text{minimize}} \DeclareMathOperator*{\subjto}{\text{subject to}} \newcolumntype{R}{>{\displaystyle}r} ...


1

Here are two ways of doing things. I define right aligned notes, that require using the flalign(*) environment and the \llap command. If there is enough white space to input a (short) note, you use the \shortrnote command. If there is not, you put the note on a line of its own. Similarly, I define left aligned notes, that use the alignat(*) environment and ...


1

Adding \usepackage{caption} results in a center-aligned caption \documentclass[graybox]{svmult} \usepackage{caption} \begin{document} \begin{figure} \centering My graphics \captionsetup{justification=centering} \caption{My caption dfhu orifv My caption dfhu orifv My caption dfhu orifv My caption dfhu orifv My caption dfhu orifv My caption dfhu orifv My ...


2

Use a minipage. \documentclass[graybox]{svmult} \begin{document} \begin{figure} \centering \begin{minipage}{.33\textwidth} \centering This text is supposed to substitute the image in this figure environment \caption{My caption} \end{minipage} \end{figure} \end{document}


4

You could use the environment multline provided by the package amsmath \documentclass{article} \usepackage{amsmath} \setlength\multlinegap{0pt} \begin{document} \begin{multline} P(x) = \\ a + b + c + d + e + f \end{multline} \end{document} The \setlength\multlinegap{0pt} assures no indentation of the first line.


4

Ypu can define the flmultline environment and its starred counterpart: \documentclass{article} \usepackage{amsmath} \usepackage{lipsum} \makeatletter \newenvironment{flmultline} {\multlinegap=\z@\start@multline\st@rredfalse} {\endmultline} \newenvironment{flmultline*} {\multlinegap=\z@\start@multline\st@rredtrue} {\endmultline} \makeatother ...


3

You could align the condition to the right margin and center the equation to the rest of the line using flalign. \documentclass{scrreprt} \usepackage{fontspec} \usepackage{amsmath}% loads also amsmath \usepackage{showframe}% to show the page layout \begin{document} \begin{flalign*} &&x_j = 1,\quad y_j = 2,\quad z_j = 3 &&\text{for }j=1, ...


7

Just load mathtools instead of amsmath (it loads the latter) and use its \mathrlap command. You may put the \qquad inside the \rlap or not. In my opinion, if you put it inside, the main part of the equation doesn't look centred to the reader,though it is. You must also be aware the condition might overlap the right margin. In such a case, I would one of ...


0

Here is a shorter code, with only one tabular environment, using booktabs and hhline: \documentclass{article} \usepackage{array, booktabs, hhline} \begin{document} \begin{table}[!ht] \centering \begin{tabular}{|c|c|c| >{\qquad}c|c|c|} \multicolumn{6}{c}{XYZ} \\ \multicolumn{3}{c}{X} & \multicolumn{1}{c} ...


1

perhaps you have missed & between the two inner tabeles , You want a table like this and you change \documentclass{article} \begin{document} \begin{table}[!ht] \begin{center} \begin{tabular}{cc} \multicolumn{2}{c}{XYZ} \\ X & Y \\ \hline \\ \begin{tabular}{|c|c|c|} ...


0

I had the same problem but the solution that was propose did not work for me. I had spent hours trying to remove these unwanted gaps in the text. I would like to share how I solved my problem, for those who are still having this issue. I used latex for my thesis and when I ended a paragraph, I used \linebreak command but it was a huge mistake that took ...


4

You can use \begin{subarray}{l}, but perhaps it's better to define a new command based on subarray (just like \substack is based on subarray). \documentclass[border=2bp]{standalone} \usepackage{amsmath} \makeatletter \newenvironment{tsubarray}[1]{% \vcenter\bgroup \Let@ \restore@math@cr \default@tag \baselineskip\fontdimen10 \scriptfont\tw@ ...


0

I found a dirty way to do it ... it works but I think it is not the best way :) Does anyone have another idea ? \documentclass{article} \usepackage{pgfplots} \pgfplotsset{compat=newest} \begin{document} \begin{figure} \begin{tikzpicture} \begin{semilogyaxis}[xmin=0, xmax=600, ymin=1e-1, ymax=1e7, axis x line*=bottom, axis y line*=left, xlabel={X}, ...


1

I assumed you wanted multiple choice because you mentioned the oneparchoices environment. I used the xpatch package to replace the 1em between choices with \hfill to evenly space the choices. This is good for very short answers. If you have longer answers, then you should look at some of the answers in this question. The code in the initial question (first ...


2

Your centring efforts are almost certainly overkill here: \begin{center} \begin{minipage}{\linewidth} \centering Generally you should only need two commands to centre images: \centering\includegraphics{...} — when the figure is smaller than the text width \centerline{\includegraphics{...}} — when the figure is wider than the text width If this ...


3

The star form of \hspace avoids to get canceled at the start of a new line: \newcommand*{\mymacro}[1]{\hspace*{\fill}\mbox{#1}\penalty-9999\relax} The penalty allows a line break, but it does not force one (-10000) to avoid an underfull \hbox warning, if the paragraph ends after \mymacro.


1

Meh... as it usually goes, as soon as I posted the question, I noticed that \path (axis cs:0,0), and I thought: "what would happen if I type rel" in there?" - and indeed, that fixes it; simply replace \path (axis cs:0,0) with: \path (rel axis cs:0,0) ... in the code above, and the plot will center as expected... It's still a brute force solution without ...


3

Include the column spacing as part of the cell contents, not the column specification: \documentclass{article} \begin{document} Original table: \begin{tabular}{@{}lr@{~~}r@{~~}r@{\hspace{10pt}}r@{\hspace{10pt}}r@{}} \hline configuration & \multicolumn{1}{c@{~~}}{$M$} & \multicolumn{1}{c@{~~}}{$w$} & ...



Top 50 recent answers are included