Tag Info

New answers tagged

0

My answer is to used {p} in \begin{tabular} to left-justify the text: \documentclass[11pt]{report} \usepackage{amsmath,array} \newcolumntype{C}[1]{>{\centering\arraybackslash}m{#1}} \begin{document} \begin{table}[] \caption{Comparisons of different PVT systems, presented in 2014.} \begin{center} \begin{tabular}{|C{1cm}|p{6cm}|C{3cm}|C{3cm}|} %\hline % ...


5

You need to make the table narrower than the text width, also as latex warns: LaTeX Warning: Unused global option(s): [paper=a4]. The document class option syntax was wrong. \documentclass[a4paper]{article} % A4 paper and 11pt font size \usepackage[dutch]{babel} % Dutch language/hyphenation \usepackage{array} ...


4

You could use empheq: \documentclass{article} \usepackage[fleqn]{amsmath} \usepackage{empheq} \newcommand{\diff}{\mathop{}\!\mathrm{d}} \newenvironment{boxedalign} {\setlength\mathindent{0pt}% \empheq[box=\fbox]{align*}} {\endempheq} \begin{document} \section{Integrals} Some text just to show alignment with the left margin that should fill a line ...


1

Here are two possible options: \documentclass{article} \usepackage[fleqn]{amsmath} \usepackage{framed,varwidth} \begin{document} \section{Integrals} \begin{framed} \begin{itemize} \item[I.] $\displaystyle \int_a^b k \mathrm{d}x = k(b - a)$ \item[II.] $\displaystyle \int_a^b k \cdot f(x) \mathrm{d}x = k \cdot \int_a^b f(x) \mathrm{d}x$ ...


0

You can provide the necessary definitions for three columns: \newlength\listtripleitemmaincolumnwidth \makeatletter \renewcommand*{\recomputecvlengths}{% \setlength{\quotewidth}{0.65\textwidth}% \setlength{\maincolumnwidth}{\textwidth-\separatorcolumnwidth-\hintscolumnwidth}% ...


4

You can use tcolorbox: \documentclass{article} \usepackage{tcolorbox} \usepackage{lipsum} \newlength{\boxindent} \AtBeginDocument{\setlength{\boxindent}{2em}} \begin{document} %% A ``ruler'' \noindent \vrule width 2em height 0.4pt depth 0pt \kern-.2pt \vrule width .4pt height 3pt depth 2.6pt \kern-.2pt \vrule width \dimexpr\textwidth-2em\relax height ...


3

Here are two options that provide similar layout. framedparA uses a center environment to set the contents horizontally inside a \parbox of required width. framedparB uses mdframed and allows to be broken across the page boundary. \documentclass{article} \usepackage{lipsum,environ,mdframed} \NewEnviron{framedparA}[1][2em]{% \begin{center} \fbox{% ...


6

Your question could be clearer but I think you want \noindent \hspace*{2em}% \fbox{\parbox{\dimexpr\textwidth-4em-2\fboxsep-2\fboxrule\relax}% {Paragraph text}} Or perhaps simpler \begin{center} \fbox{\parbox{\dimexpr\textwidth-4em-2\fboxsep-2\fboxrule\relax}% {Paragraph text}} \end{center}


3

Put \bordermatrix inside \[ \] and make it a display equation. \documentclass{article} \usepackage{amsmath,braket} \newcommand{\dirint}{\int} %% just for compiling, change it in your file \begin{document} \begin{figure}[h!] \[ \bordermatrix{~& \ket{\Phi_{0}} & \ket{S} & \ket{D} & \ket{T} & \ket{Q} & \dots \cr ...


5

With swiss army knife tikz: \documentclass{article} \usepackage{tikz} \begin{document} \begin{tikzpicture} \node[inner sep = 0pt] (a) {\includegraphics[width=6cm]{example-image-a}}; \node[anchor=south,inner sep=1pt] at (a.south) {This is $x-$label}; \node[anchor=south,inner sep=1pt,rotate=-90] at (a.west) {This is $y-$label}; ...


1

This uses the stackengine package. Here, the x-axis label is centered horizontally, with the offset to the bottom of the label specified from the bottom of the graph. Likewise, the y-axis label is centered vertically, with the offset to the left of the label specified from the left of the graph. EDITED to show that image aspect poses no problems; nor does ...


3

\put(50,1){\makebox(0,0){some x-label}} will put the (horizontal and vertical) centre of of the text at the specified position. To rotate text you can use \rotatebox \put(50,1){\makebox(0,0){\rotatebox{90}{some x-label}}}


0

I want point out that there are problems in the previous answers and give more simple solution. The egerg's answer includes the ad-hoc correction \vglue-\ht\strutbox. The vertical positioning of the margin note text depends on the depth of the line in the paragraph and on the height of the first line in the note text in his solution. You can try to remove ...


0

IEEEtran has a conference mode which automatically centers all the captions. Adding following to your LaTeX code would center all the captions. \documentclass[conference]{IEEEtran} Although, I would also agree with @Werner, that it's best to stick to the format specified by the journal you are submitting.


7

I think that using the sectsty package is simpler. Just add the following lines to your preamble \usepackage{sectsty} \renewcommand{\thechapter}{\Roman{chapter}} \chapterfont{\centering\MakeUppercase} MWE \documentclass[12pt]{book} \pagestyle{plain} \usepackage{amssymb,latexsym} \usepackage{amsmath} \usepackage{amsthm} \usepackage{sectsty} ...


3

Here is a crude way of implementing your requirement. It uses etoolbox to patch the macros responsible for creating the chapter headings. There are two macros, one for \chapter and one for \chapter*. In each of these macros, an adjustment is made to the chapter title (argument #1) as well as the horizontal alignment - changing from \raggedright to ...


5

TeX is not “free form” and spaces are significant: remember that it's a program for typesetting. You have several spaces in your commands: \newcommand\entryOne[1]{ \ifnum #1 = 100 #1 \fi } The end of line after the brace counts as a space; also the space after the second #1 counts. It's true that in a table cell both are removed, but it's not a good ...


6

You don't need \captionof here. Add a \hfill in between two minipages. \documentclass{article} \usepackage[demo]{graphicx} \usepackage{kantlipsum} \begin{document} \begin{figure} %\centering \begin{minipage}{0.48\textwidth} \centering \includegraphics[width=0.97\linewidth]{a} \caption{\kant*[1]} \end{minipage} \hfill \begin{minipage}{0.48\textwidth} ...


2

You can make your minipages narrower and push them as far as possible (they are just separated by a word space in your posted code). \begin{minipage}{0.4\textwidth} \includegraphics[width=0.97\linewidth]{a.eps} \captionof{figure}{caption as in image} \end{minipage}\hfill \begin{minipage}{0.4\textwidth} \includegraphics[width=0.97\linewidth]{b.eps} ...


1

enumitem already provides a right alignment for labels. Use it with leftmargin=\labelsep \documentclass{article} \usepackage{enumitem} \usepackage{showframe} % just to show the margins \begin{document} \begin{description}[align=right,leftmargin=\labelsep] \item[A] text text text \item[ABC] text text text \end{description} \end{document}


3

This is easy with the enumitem package. Just define \SetLabelAlign{margin}{\llap{#1~~}} and use it like \begin{description}[align=margin,labelsep=0pt] \item[A] text text text \item[ABC] text text text \end{description} MWE \documentclass{article} \usepackage{enumitem} \SetLabelAlign{margin}{\llap{#1~~}} \usepackage{showframe} % just to show the ...


2

Something like this: (???) The showframe package is just for to show the position of the margins. It can be removed. \documentclass{article} \usepackage{showframe} \begin{document} \setlength{leftmargini}{0pt} \begin{itemize} \item[A] text text text \item[ABC] text text text \end{itemize} \end{document}


3

Re. 1 and part of 3: You can use \newcolumntype{Q}[2][mColor1]{>{\columncolor{#1}\raggedright\arraybackslash}p{#2}}% takes 1 optional and 1 required argument \newcolumntype{B}[2]{>{\columncolor{#1}\centering\arraybackslash}p{#2}}% takes 2 required arguments \newcolumntype{S}[1]{>{\columncolor{mColor1}\raggedleft\arraybackslash}p{#1}} in ...


3

Here's a TABstack approach. \documentclass{article} \usepackage{tabstackengine,amsmath,calc} \stackMath \begin{document} \begin{equation} \setstackgap{S}{6pt} \alignShortunderstack{ \left(\dfrac{4}{2 \cdot 2 \cdot 10 ^{-6}}\right)^2 \mathrel{\protect\makebox[\widthof{$<$}]{$?$}}& \left(\dfrac{1}{2 \cdot 10 ^{-6} \cdot 450 \cdot 10 ^{-12}}\right) \\ ...


5

Horizontal alignment in this case relies on the fact that the aligned symbols have the same width. \documentclass{article} \usepackage{amsmath} \newcommand{\qrel}{\mathrel{\mathpalette\doqrel\relax}} \makeatletter \newcommand{\doqrel}[2]{% \ooalign{\hidewidth$\m@th#1?$\hidewidth\cr\hphantom{$\m@th#1=$}\cr}% } \makeatother \begin{document} ...


1

In this case, it's straightforward to use an array environment, with the material in the first and third columns set in \displaystyle. To change the amount of whitespace that's inserted around the ? and < symbols, modify the parameter \arraycolsep; its default value in most (all?) document classes is 5pt; in the code below I've set it to 2.5pt. The ...


5

You need to give the ? the same spacing as the < by typing \mathrel{?}. Also you might want to leave out the extra \; on both sides, as TeX keeps track of correct spacing for relations. \documentclass{article} \usepackage{empheq} \begin{document} \begin{align} \left(\frac{4}{2 \cdot 2 \cdot 10 ^{-6}}\right)^2 &\mathrel{?} \left(\frac{1}{2 \cdot 10 ...


2

In order for the centering to be effective, you have to ignore the widths: \documentclass{article} \usepackage{marvosym} \newcommand{\longcontact}[5]{% <--- don't forget \par % be sure to start a new line \Gentsroom\ #1 \hfill \ComputerMouse\ #2% \par\nopagebreak \makebox[0pt][l]{\Letter\ #3}% zero width \hfill % fill ...


3

Use the same settings when you call \theendnotes, that is \begin{sloppypar}\theendnotes\end{sloppypar} MWE \documentclass[12pt]{book} \usepackage{lipsum} \usepackage{endnotes} \usepackage[top=2.25cm, left=1.25cm, bottom=2.75cm, right=1.25cm, paperwidth=120mm, paperheight=200mm]{geometry} \usepackage{ragged2e} \usepackage{polyglossia} ...


3

As beamer does not like the package enumitem, you will have to define your own "description item". % arara: pdflatex \documentclass[handout]{beamer} \defbeamertemplate{description item}{align left}{\insertdescriptionitem\hfill} \begin{document} \begin{frame} \frametitle{Analyse: Ziele laut Pflichtenheft} \setbeamertemplate{description ...


3

This can be done with the caption package and the setup \captionsetup[table]{singlelinecheck=false,position=top} After that you have to insert your caption inside a \captionbox as in the following MWE \documentclass{article} \usepackage{caption} \captionsetup[table]{singlelinecheck=false,position=top} \begin{document} \begin{table} \centering ...


3

The simplest way is to use the threeparttable package, which measures the tables widths. Here is a code, in which I improved vertical spacing of rows: \documentclass{article} \usepackage[singlelinecheck = off]{caption} \usepackage{threeparttable, booktabs} \begin{document} \begin{table} \centering\renewcommand\arraystretch{1.1} \begin{threeparttable} ...


2

As shown in http://tex.stackexchange.com/a/208681/32374, you need to change how you specify the enlargement of the axes. Instead of enlargelimits=0.15, use enlarge x limits=.15, enlarge y limits={0.15, upper}, Then, I had to specify also ymin=0. I also edited your axes to use the ybar style instead of the plots, since this sets up the tick marks and such ...


5

The problem you are seeing here is that equation and align do use different approaches when a formula is getting too long (what is the case here). equation is trying to compensate that mistake by replacing the normal inter-symbol-distance by a 'squeezable' distance (pink in my image below). align does not use this trick. I give two examples with different ...


3

You also need the following line in your preamble \DeclareCaptionTextFormat{tabletext}{\hspace{-\parindent}\textit{#1}} This is the same definition used for doc mode. MWE: \documentclass[man,apacite,noextraspace]{apa6} \usepackage[utf8x]{inputenc} \usepackage{graphicx} \usepackage{subcaption} \usepackage{amsmath} \usepackage{amscd} \usepackage{float} ...


5

You are using the syntax of eqnarray for the alignment of the relations. The correct syntax is &=. If you really want the left hand sides to be left aligned, you can use alignat, but I don't think it will give a good result. In the example, I'll leave only the necessary packages (amsmath). \documentclass[fleqn]{article} \usepackage{amsmath} ...


2

Two suggestions: Since you're using an align* environment, use &= rather than &=& to align the equations on the = symbols. While you're at it, do also omit the trailing & characters at the end of each equation. Issue the instruction \DeclareMathOperator{\Sp}{Sp} in the preamble (after loading amsmath); this will simplify the code writing ...


4

This doesn't happen with enumitem. It is better to use enumitem instead of enumerate as the former is more flexible and modern. \documentclass{article} \usepackage{enumitem} \begin{document} \begin{enumerate} \item First Item \item Second Item \end{enumerate} \begin{enumerate}[label=\alph*.] \item First Item \item Second Item \end{enumerate} ...


2

Here's another solution using tikz-cd, which I personally use for such diagrams most of the time: \documentclass{article} \usepackage{mathtools} \usepackage{tikz-cd} \begin{document} \[ \begin{tikzcd}[arrows=to] \cdots \rar & H_n(A \cap B) \rar & H_n(A) \oplus H_n(B) \rar & H_n(X) \rar & \hphantom{0}\\ \hphantom{\cdots} ...


1

First of all, check page 20 of the manual for how to write molecule names properly using chemname. There you can also find the alignment methods. In your case, this should work: \begin{center} \schemestart \chemnameinit{\chemfig{*6(=(-[,.65]CH_2OH)-=-(-[,.65]OH)=-)}} \chemfig{*6(=-=-(-[,.65]OH)=-)} \chemsign{+} \chemname{\chemfig{CH_2O}}{Formaldehyde} ...


5

You can exploit the direct sum symbol and avoid any computation: \documentclass{article} \usepackage{amsmath} \begin{document} \begin{alignat*}{2} \cdots & \to H_{n}(A\cap B)\to H_{n}(A) & {}\oplus H_{n}(B) & \to H_{n}(X)\to \\ & \to H_{n-1}(A\cap B)\to\cdots & \cdots & \to H_{0}(X)\to 0 \end{alignat*} ...


7

Here is a possible solution using the package mathtools (which is kind of a successor of amsmath): % arara: pdflatex \documentclass{article} \usepackage{mathtools} \begin{document} \begin{alignat*}{2} \cdots &\rightarrow H_{n}(A\cap B)\rightarrow H_{n}(A)\oplus H_{n}(B) &&\rightarrow H_{n}(X)\rightarrow \\ ...


2

There is a great macro written by Petr Olsak from the Czech Republic, which perhaps beats even eplain. Olsak is notorious for prefering plainTeX over LaTeX, and he wrote this macro in order to offer the power of LaTeX to plainTeX users. The name of the file (opmac.tex) actually stand for Olsak's Plaintex MACros. http://petr.olsak.net/opmac-e.html ...


4

I don't follow your comment about \cline not being available in the elsarticle document class with the packages you load. I experience no problems using \cline{2-11} (instead of {} & \multicolumn{10}{c}{\hrulefill}) to get a horizontal line that doesn't break up the vertical line between columns 6 and 7. Given the structure of the matrix, I would ...


2

Simply invert minipage with \scalebox, i.e. embed the minipage inside \scalebox. MWE: \documentclass{beamer} \mode<presentation> { \usetheme{CambridgeUS} \usecolortheme{dolphin} \usecolortheme{rose} \setbeamerfont*{title}{shape=\itshape, family=\rmfamily} \setbeamercovered{transparent} } \usepackage{algorithm2e} \begin{document} ...


2

Set both items in a minipage of similar widths. Then adjustments to the horizontal alignment should match, since the minipage has a default left-alignment (actually justified): \documentclass{beamer} \let\Tiny\tiny% http://tex.stackexchange.com/a/94159/5764 \usepackage{algorithm2e} \begin{document} \begin{frame} \begin{center} ...


1

This is easy with the tablists package and also the syntax is much friendler. \documentclass[10pt]{amsart} \usepackage{tikz} \usetikzlibrary{calc,angles,positioning,intersections,quotes,decorations.markings} \usepackage{tkz-euclide} \usetkzobj{all} \usepackage{pgfplots} \pgfplotsset{compat=1.11} \usepackage{tablists,enumitem,amsmath} ...


0

I adopted a tabstack approach to solving the problem. Changes to your MWE included: 1) Replacing \begin{alignat*}{8}...\end{alignat*} with \[ \makebox[\textwidth][l]{\kern4em\alignShortstack{...}}\] It has the effect of indenting the aligned Shortstack 4em from the left margin; 2) Replacing all your \ & with &\; and 3) Using an \llap on ...


7

\documentclass{article} \usepackage{enumitem,xcolor} \usepackage{showframe} \begin{document} \begin{description}[font=\color{black},before=\color{blue},nosep] \raggedleft %% put this here \item[Item:] some text some text some text \item[Another item:] some text \item[Very long item:] some text some text \item[Short ...


3

This is a (very late!) supplement to lockstep's answer which just offers a visual demonstration of the difference between the use of \centering and the center environment within figure environments. Each page shows 2 figures, one using \centering and one using center. The differences in spacing are the result of ordering the two figure environments ...



Top 50 recent answers are included