New answers tagged

6

This example should lift any doubt about what to measure; note that in the first two cases the hairlines are perfectly superimposed to each other, showing that there's no issue with \Shortstack. On the other hand, the difference you measured is less than 0.4pt, too small to be really noticeable: it depends on the bounding boxes of the characters. ...


11

I think you are just not taking account of sidebearings of the characters so the actual character widths used for centering include some white space. TeX has no information about the glyph shape, it can not tell what parts of a specified character width are black. \documentclass{article} \usepackage{stackengine} \begin{document} ...


3

Why not just this? \documentclass{article} \newcommand{\listOfYears}[3]{% \begin{minipage}{0.08\textwidth} #1 \end{minipage}% \begin{minipage}{0.30\textwidth} #2 \end{minipage} \par \hspace*{.08\textwidth}% \begin{minipage}{0.30\textwidth} \textit{#3} \end{minipage} } \begin{document} \listOfYears{765}{235}{3098} \end{document} ...


2

If you know the longest entry, a solutiom may be as follows: \documentclass{article} \usepackage{amsmath} \begin{document} \newlength{\myjjj} \begin{equation*} \settowidth{\myjjj}{$jjjjjjjjj,$} %longest entry \begin{aligned} & a=\begin{cases} \makebox[\myjjj][l]{$bbbb,$}\ &\text{if}\ c\,;\\ dd,\ &\text{if}\ e\,;\\ fffff,\ ...


0

Jus fort fun, without tabular, without minipage and without ubiquitous \vspace{1ex}: \documentclass[12pt,paper=a4,answers, addpoints]{exam} \usepackage{tabto,graphicx} \TabPositions{0pt, 0.23\linewidth, 0.5\linewidth} \begin{document} {\obeylines{\centering \includegraphics[width=5em]{mesina.png} \em\bfseries University of XXX Dipartiment of XXX ...


5

I suggest you replace \par \bigskip\bigskip \begin{minipage}[t]{.5\textwidth}% {\bfseries Corso di Studio}: First course \\ Second course\\ Third Course \par \vspace{1ex} with \par \bigskip\bigskip \noindent % <--- new \begin{minipage}[t]{.5\textwidth}% {\bfseries Corso di Studio}: \parbox[t]{4cm}{First course \\ Second course\\ ...


6

tabular for the course The three courses can be put in a tabular: \textbf{Corso di Studio:} \begin{tabular}[t]{@{}l@{}} First course\\ Second course\\ Third course\\ \end{tabular} tabularx with two columns X column type is a p column type, which uses the available space. \documentclass{article} \usepackage{tabularx} \begin{document} ...


4

The fermion, Majorana and charged boson styles actually all use an internal (and undocumented) with arrow style. I didn't make the with arrow style public because I didn't initially envisage it being needed though I think I will be making it public in the next version of TikZ-Feynman. The with arrow and with reversed arrow styles place an arrow or reversed ...


2

In general, this is a little bit tricky, as there so many things influencing the size, but for this case, where the ticklabels on the y-axis are the only thing causing problems, you could try adding 'extraAxisOptions','yticklabel style={text width= width("$-0.6$")},align=right}' the matlab2tikz calls, where $-0.6$ is the widest ticklabel. As a ...


3

Use \displaystyle to force content to be set similar to display math: \documentclass{article} \usepackage{algpseudocode,amsmath} \DeclareMathOperator*{\argmax}{arg\,max}% http://tex.stackexchange.com/q/5223/5764 \begin{document} \begin{algorithmic}[1] \State $\displaystyle E_i = \argmax_{E \in \mathcal{E}} F(E)$ \State $E_i = \argmax_{E \in ...


0

I see you are using the memoir class, which provides a variety of centred chapter titles. If you want to use one of these a simple \chapterstyle{name} in your preamble is all you need. Read section 6.5 Chapter Headings in the manual (texdoc memoir) for graphic display of the styles, and also how to create your own.


1

Try with alignat: \documentclass{article} \usepackage{amsmath} \begin{document} \begin{align*} V[1] &= A[1] & i = 1 \\ V[2] &= \max \{ A[1], A[2] \} & i=2 \\ V[i] &= \max\{ V[i-1], V[i-2] + A[i] \} & i>2 \end{align*} \begin{alignat*}{2} V[1] &= A[1] & \quad i &= 1 \\ V[2] &= ...


1

Assuming you're using one of the "standard" document classes (i.e., article, report or book) or a document class that's based on one of the standard classes, you could achieve your objective by adding the following instructions to the preamble: \usepackage{sectsty} \chapterfont{\centering}


8

This answer assumes you are using the report or book document classes. i.e. \documentclass[...]{report} or \documentclass[...]{book} is at the top of your document. The Easy Way The easiest way to achieve what you are looking for is to use the expanded form of the chapter command: % ## Expanded \chapter command ## % Format: ...


8

Well, it seems there is a bug (or is it a feature?) in your used class IEEEtran. Or it results in the using of package subfigure, which called package caption. And that package caption results in the following warning you should not oversee: Package caption Info: Unknown document class (or package), (caption) standard defaults will be used. ) ...


3

Add a multicolumn that spans no columns. \documentclass[12pt,a4paper]{book} \def\x{This is a text aligned according to column alignment defined in tablular.} \def\y{Centered text} \begin{document} \begin{tabular}{l|l} \x & \x \\ \x & \x \\ \multicolumn{1}{c}{\y} & \x \end{tabular} \endtabular} \end{document}


0

If you don't specify text height and text depth, that is the default behaviour. To have them all the same height, set a minimum height. \documentclass[border=5mm]{standalone} \usepackage[latin1]{inputenc} \usepackage{tikz} \usetikzlibrary{calc, shapes, fit, positioning} \begin{document} \tikzset{ block/.style = {rectangle, draw, rounded corners, text ...


0

I used a \Centerstack on the text, and adjusted the text height and text depth. \documentclass[border=5mm]{standalone} \usepackage[latin1]{inputenc} \usepackage{tikz,stackengine} \setstackEOL{\\} \usetikzlibrary{calc, shapes, fit, positioning} \begin{document} \tikzset{ block/.style = {rectangle, draw, rounded corners, text width=6.0cm, text ...


1

You probably will prefer \RaggedRight from the ragged2e package which limits the raggedness (and allows hyphenation) but is ragged when needed.


2

You're using the wrong tool: matrix centers each cell. \begin{equation*} \text{when } \begin{cases} a(E)'=\infty, &\text{if $E=\bar{L}$} \\ a(E)'=0, &\text{if $E=0$} \end{cases} \end{equation*}


3

\begin{aligned} & 0.625\cdot2=1 + 0.25\\ & 0.25\cdot2=0 + 0.5\\ & 0.5\cdot2=1\\ \end{aligned}


4

That equation editor uses eqnarray to set the equation, so avoid it. Perhaps use a different online editor: \hspace*{-\parindent} 0.625 \cdot 2 &= 1 + 0.25 \\ 0.25 \cdot 2 &= 0 + 0.5 \\ 0.5 \cdot 2 &= 1 \begin{align*} 0.625 \cdot 2 &= 1 + 0.25 \\ 0.25 \cdot 2 &= 0 + 0.5 \\ 0.5 \cdot 2 &= 1 \end{align*}


1

Don't mix the use of two ToC-related packages. That's why any adjustment to \cftpnumalign doesn't show in the ToC, since titletoc has completely rewritten the way ToC-related entries are handled. The following is all that's needed to change the alignment (and width): \makeatletter ...


0

I don't know about tocloft or titletoc, but for plain old article class... \documentclass{article} \usepackage{showframe} \makeatletter \def\@pnumwidth{.5in}% maximum width for number on right \renewcommand*\l@part[2]{% \ifnum \c@tocdepth >-2\relax \addpenalty\@secpenalty \addvspace{2.25em \@plus\p@}% \setlength\@tempdima{3em}% ...


2

Remove \centering from the definition of \section using an etoolbox patch. Since the patch would be permanent from that point forward, you can save the original and modified definitions and creates switches to change the style on demand: \documentclass{amsart} \let\centeredsection\section% Copy original centered definition of \section ...


0

This is readily achievable using sectsty and some manual adjustments for the \chapter setting: \documentclass{report} \usepackage{sectsty} % http://tex.stackexchange.com/q/59726/5764 \allsectionsfont{\centering\normalsize\bfseries}% All sections are centred/normal size/bold \subsectionfont{\normalsize\bfseries}% Correct \subsection formatting ...


3

Simply use \rlap and \llap where relevant (and \centering to centre the image itself, of course): \documentclass[letterpaper]{article} \usepackage{subcaption} \usepackage{pgfplots} \pgfplotsset{compat=newest} \usepackage{tikz} \usepackage{graphicx} \begin{document} \begin{figure} \centering \begin{subfigure}[b]{0.9\textwidth} \centering ...


3

Add \centering at the start of the subfigure, and then add \useasboundingbox (image.south east) rectangle (image.north west); in the tikzpicture just before the scope. This way the bounding box of the tikzpicture is defined only by the size of the image. By the way, pgfplots loads tikz, and tikz loads graphicx. Therefore you don't actually have to load the ...


3

Try this: apply a \raisebox{\dimexpr-\height+\ht\strutbox}{...} to the image. The explanation is that the two minipages are, in fact, aligned to their top baseline (as requested with the [t] option of minipage). The problem is that included image extends well above the top baseline, whereas the text does not. This occurs because \includegraphics always ...


5

I looks like the fact that you've wrapped S[..] in braces throws the parser off. At least, removing the {} removes the error. Note that vertical rules and booktabs don't go well together, so below I've removed the rules. I also used an S column for all the six last columns, that have numbers, and some other small changes. \documentclass{article} ...


1

Write this: \begin{align*} & \phantom{{}={}}\text{long string of variables}\\ & = \text{another long string of variables} \end{align*} or this (as suggested by @daleif): \begin{align*} &\text{long string of variables}\\ ={} & \text{another long string of variables} \end{align*}


0

Something like this? This picture was produced by: \documentclass{article} \usepackage[demo]{graphicx} \usepackage{floatrow} \floatsetup[table]{capposition=top,footnoterule=none,footskip=.35\skip\footins} \usepackage{subfig} \begin{document} \begin{table} \centering \begin{tabular}{cc} \subfloat[]{ \begin{tabular}[t]{cc} Test&Test\\ ...


1

You could use \@afterheading\@afterindentfalse at the end of your \myheading command: \documentclass{article} \makeatletter \newcommand\myheading[1]{\par \bigskip \hrule height 1pt \kern 2pt \hbox to \textwidth{\textbf{#1}\hfill} \kern 2pt \hrule height 0.5pt \kern\smallskipamount \@afterheading\@afterindentfalse } ...


1

You need only two minipages without a black line between them (but it is fine insert some space as \hfill or \quad). To left both at the bottom, you can use \vfill (or a figure environment with the [b] option, if the figure and text can float to another page) \documentclass[a4paper]{article} \usepackage{graphicx} \usepackage{lipsum} \begin{document} ...


0

\multicolumn{3}{c}% {{ \raggedleft \tablename\ \thetable{} -- continued from previous page}} \\ a c column is a horizontal box like \mbox so paragraph settings like \raggedleft have no effect, you presumably want \multicolumn{3}{r}% {\tablename\ \thetable{} -- continued from previous page} \\ to get a flush right entry.


2

At the time of writing, moderncv currently has 5 default themes (casual, classic, banking, oldstyle, and fancy). Of these 5 default themes, banking is the only one that puts the title/header information in the top center of the page, like you want: To use this theme, you just need to declare \moderncvstyle{banking} in your preamble. The following MWE ...


4

The reason the next line does not start at the left is because LaTeX considers it to be the start of a new paragraph. This always happens if you have a blank line between the display equation and the following text, like so: % incorrect example – don't do this! We can then show that \begin{equation} a = 5, \end{equation} where $a$ is a constant. ...


1

The enumerate environment is designed to enumerate downwards, not from left to right. There are some packages for this, e.g. paralist or the sophisticated task package. E.g. say \begin{task}(2) etc. for 2 columns, the \task command does what \item does for enumerate. The counter-format=tsk[1]) option will use arabic numbers with a closing ), the ...


0

Simply using the following works too: \renewcommand{\contentsname}{\centering Contents}


2

You can use standard \parbox and \makebox commands. There is a subtle point that you seem to be overlooking: the baselineskip might be not uniform with a \vtop (or \parbox[t], which is the same) approach. \documentclass[fontsize=13pt,letterpaper]{scrartcl} \usepackage[textwidth=5in,showframe]{geometry} \usepackage{fontspec} ...


0

A way via some \hphantoms and \mathrlap. The latter is defined by mathtools, hence I've replaced amsmath with that package. (mathtools loads and extends amsmath.) Note that in align you should have &=, not =&. \documentclass[12pt]{article} \usepackage{mathtools} \usepackage{amsfonts} \usepackage{amssymb} \begin{document} \begin{align*} y_t &= ...


2

Here's one approach using the AMS-provided alignat environment: \documentclass[12pt]{article} \usepackage{amsmath} \usepackage{amsfonts} \usepackage{amssymb} \begin{document} \begin{alignat*}{5} y_t = {} & \varphi_1rer_t & {}+{} & \varphi_2 \pi_t & {} + u_t \\ t: \quad & [2.89] & & [8.63] ...


6

What you need to know for doing a "box arithmetic" is TeX changes vertical to horizontal mode at some places and returns back at others places. \vbox or \vtop has its width given as most wider element in it. If this is whole paragraph then the width is \hsize. So it is typical to set a width of \vbox or \vtop by \vtop{\hsize= something ...} When TeX is ...


0

Here is a working solution. After the first run things aren't aligned. The second time through they are. \documentclass[11pt]{article} \usepackage{enumitem,lipsum,atbegshi,ifthen} \parindent=0pt \IfFileExists{\jobname .ali}{\input{\jobname .ali}}{} \newwrite\AlignmentOutput \immediate\openout\AlignmentOutput=\jobname .ali \newlength\LatestWidth ...


25

While I couldn't get David Carlisle's answer to work, I made a simple tielable vector version of the xkcd snake: \documentclass{article} \usepackage[text={1.2in,3in}]{geometry} \usepackage[none]{hyphenat} \directlua{ PDF_LITERAL = node.subtype("pdf_literal") WS = node.id("whatsit") GLUE = node.id("glue") add_image = function(line, n, ...


27

Really is not a snake, but ... \documentclass{article} \usepackage[text={1.2in,3in}]{geometry} \def\snake{\cleaders\hbox to .5em{\hss\ensuremath\sim\hss% \hspace{-.3em minus -.2em}% }\hfill$^{_\diamond}$\break} \raggedright \begin{document} \noindent Their famous paper on the relationship between \snake deindustrialization and \snake the growth of ...


21

this is lualatex only and draws a PDF line w points wide to pad out each line, if you are feeling artistic replace w 0 l by something that draws a snake of the same length \documentclass{article} \directlua{ PDF_LITERAL = node.subtype("pdf_literal") WS=node.id("whatsit") GLUE = node.id("glue") snakefill=function(head) for line in ...


19

The snake could be improved. Also I never know how to do calculations with tikz coordinates, so I use zref instead. Edit Actually I think that my first example didn't work in all cases as the begin and end mark doesn't need to be at the same position even if they were on the same line. So it is better to test if the second mark is at the end of the line. ...


1

You may have to reduce the inter-column spacing by adding something like \setlength{\tabcolsep}{<len>} before the tabular (or placing it inside a group to limit the scope of the change, like inside a table environment). Either fix <len> or use something relative, like .5\tabcolsep to reduce the current \tabcolsep to 50% of its value. \tabcolsep ...


2

I don't think systeme is the right tool. \documentclass[twocolumn,oneside]{revtex4-1} \usepackage{array} \usepackage{amsmath} \numberwithin{equation}{section} \begin{document} \begin{equation} \{(\bar 6\oplus 3)\otimes(6\oplus\bar 3)\}_c = \left\{ \renewcommand{\arraystretch}{1.2} \settowidth{\dimen0}{$0$} \begin{array}{r@{}>{{}}l@{}>{{}}l} ...



Top 50 recent answers are included