Hot answers tagged

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 ...


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, ...


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. ...


6

There are several things that you should do: Use a display-style math environment, like \[ ... \]. Use the cases environment to typeset mathematical cases. Use a \parbox to allow your text to be typeset on several lines. This said, you can do this: \[y_{pij}^{mk} = \begin{cases} 1, & \parbox{5cm}{If the robot loads or uloades a part to/from machine ...


5

pscyr isn't in the main distributions but I can get a similar effect without it if I change some word lengths by appending x in a few places really \pretolerance=10000 % Разрешение на подгон means "I don't care about bad white space" so you get what you ask for. better to let tex try harder to linebreak by allowing the later passes even though ...


5

Some suggestions, made in no particular order: If you don't want indentation of the first line of a paragraph, you should set the \parskip parameter to a nonzero length; otherwise, it's really hard for readers to tell when a paragraph begins. Use blank lines to create paragraph breaks. For sure, don't use \\ to induce paragraph breaks. Do get rid of the ...


4

For example, in the first case, naturally I thought TeX would break the World it is part to the second line since the normal width of the glue is much larger than the page width. Since the glue has no stretch or shrink component 300cm is not the "normal width" it is its fixed width. the only break point in #1\hskip 300cm \hbox{#2} is before the skip ...


4

The horizontal skip sticks to the next thing because there is no way for TeX to break the line here. There is no space following the skip because any space here is consumed by the processing. If you take #2 out of the \hbox, you'll see that only the first word disappears and the rest goes to the next line because now you have a space allowing a line break. ...


4

Here is a solution that doesn't make the comma globally active: \documentclass{article} \newcommand{\splitatcommas}[1]{% \begingroup \begingroup\lccode`~=`, \lowercase{\endgroup \edef~{\mathchar\the\mathcode`, \penalty0 \noexpand\hspace{0pt plus 1em}}% }\mathcode`,="8000 #1% \endgroup } \begin{document} ...


4

You could --locally or generally -- add the colon to the nobreak list: \documentclass{beamer} \usepackage{etoolbox} \begin{document} \begin{frame} \frametitle{Weiterführende Informationen} \begin{itemize}\appto\UrlNoBreaks{\do\:}% \item \url{https://docs.oracle.com/javase/tutorial/collections/} \end{itemize} \end{frame} \end{document}


4

In general, it is bad practice to try to force spacing. You should focus on content and let LaTeX do its thing. If you want to change how things look on all pages, maybe you want to change your margins? If you really want to add some blank space, you may want to use \vspace. for example, \vspace{1cm} will add a empty vertical space of 1 centimeter.


3

Try to employ package makecell and use its macro \thead. In this case you need to manually broke lines in the column heads where those is necessary. For example: \documentclass{article} \usepackage{lscape} \usepackage[table]{xcolor} \usepackage{tabu} \usepackage{makecell,multirow} \renewcommand\theadfont{\bfseries} \begin{document} \begin{landscape} ...


3

Try it out: \documentclass[11pt]{article} \textwidth=3cm \begin{document} blub xxxxxxx xxxxxxx xxxxxxx xxxxxxx xxxxxxx xxxxxxx \hfuzz=40pt blub xxxxxxx xxxxxxx xxxxxxx xxxxxxx xxxxxxx xxxxxxx \emergencystretch=1em blub xxxxxxx xxxxxxx xxxxxxx xxxxxxx xxxxxxx xxxxxxx \end{document}


2

Some examples and solutions: \documentclass{article} \usepackage{varwidth} \usepackage{parskip} \begin{document} \texttt{line 1\\line 2} \emph{line 1\\line 2} But: \mbox{line 1\\line 2} \fbox{line 1\\line2} Solutions: \fbox{\parbox{5cm}{line 1\\line 2}} % or environment minipage % varwidth is like minipage, but truncates the lines if possible: ...


2

It's done automatically: \documentclass[12pt,a4paper,twoside]{book} \usepackage{graphicx} \usepackage{algorithm} \usepackage{algpseudocode} \begin{document} \begin{algorithm*}[t!] \caption{caption} \begin{algorithmic}[1] \Require{require} \State {test tttt tttt tttt tttt tttt tttt tttt tttt tttt tttt tttt tttt tttt tttt tttt tttt tttt tttt tttt ...


2

Try \documentclass{article} \usepackage{subfig} \usepackage{mwe} %\usepackage[showframe]{geometry} \begin{document} \begin{figure} \subfloat[]{% \includegraphics[width=0.6666\linewidth]{example-image-a}} \subfloat[]{\begin{tabular}[b]{c}% \includegraphics[width=0.3333\linewidth]{example-image-b}\\ ...


2

I'm not sure this is what you're looking for, but here it is. \documentclass{article} \usepackage{verbatim} \makeatletter \newenvironment{mycode} {\def\@xobeysp{\ }\verbatim\rightskip=0pt plus 6em\relax} {\endverbatim} \makeatother \begin{document} \begin{mycode} aaa { \ } aaa { \ } aaa { \ } aaa { \ } aaa { \ } aaa { \ } aaa { \ } aaa { \ } aaa { \ } ...


2

First option does what you want, although I prefer second solution with + not aligned with =. \documentclass{article} \usepackage[utf8]{inputenc} \usepackage{mathtools} \begin{document} \begin{equation} \begin{split} F = & \left\{ abc \right.\\ + & \left. def \right\} \end{split} \end{equation} \begin{equation} \begin{split} F = & \left\{ ...


2

There is no \@alltt but like verbatim (and most latex display constructs) alltt is a trivlist so the same settings apply, you just need \preto{\alltt}{\topsep=0pt \partopsep=0pt}


1

Set your content inside a box that has the appropriate width, and place that box inside a \colorbox: \documentclass{article} \usepackage{xcolor} \newcommand{\cbox}[2][yellow]{% \colorbox{#1}{\parbox{\dimexpr\linewidth-2\fboxsep}{\strut #2\strut}}% } \begin{document} Lorem ipsum dolor sit amet, consectetur adipiscing elit. Donec imperdiet elementum ...


1

Setting \pretolerance or \tolerance to 10000 means that it is allowed for TeX to produce lines with arbitrary badness much higher than 10000 if computed by the usual formula of the available stretch in the line (e.g., a line with just two words as in your case). But TeX will still try to opimize the whole paragraph: so with the above setting it can put all ...


1

Here is a possibility, I created a macro \hr. \documentclass{article} \usepackage{lipsum} \newcommand\hr{\par\vspace{-.5\ht\strutbox}\noindent\hrulefill\par} \begin{document} \lipsum[1] \hr \lipsum[2] \hr \lipsum[3] \clearpage \section{header} \hr \lipsum[4] \section{header} \lipsum[4] \end{document}


1

Definitions are usually made with a theorem package like amsthm. On the other hand, if you are not sure if you want some more fancy stuff later on, i would start with something based on tcolorbox. The example shows the default box, it can be customized in various ways, to look more simple or to look even much more fancy. \documentclass{article} ...


1

Here's one option, by setting the content of the section inside a \parbox which allows for using \\: \documentclass{article} \usepackage{xcolor} \usepackage{xparse} \definecolor{color0}{rgb}{0,0,0}% black \definecolor{color1}{rgb}{0.22,0.45,0.70}% light blue \definecolor{color2}{rgb}{0.45,0.45,0.45}% dark grey \makeatletter \newlength{\hintscolumnwidth} ...


1

What I meant was to put a \parbox into #3: \documentclass{article} \usepackage[dvipsnames]{xcolor} \usepackage{tikz} \usepackage{lipsum} \usetikzlibrary{fadings} \newcommand\fadingtext[3][]{% \begin{tikzfadingfrompicture}[name=fading letter] \node[text=transparent!0,inner xsep=0pt,outer xsep=0pt,#1] {#3}; \end{tikzfadingfrompicture}% ...


1

Simply try gatherand the \notag command: \documentclass{article} \usepackage{mathtools} \begin{document} \begin{gather} \frac{p_{0a}}{p_{a}}=\Bigl(1+\frac{\gamma-1}{2} M_{a}²\Bigr)^{\frac{γ}{\gamma-1}}\label{p0/p}\\ \frac{p_{0a}}{19,000Pa}=\Bigl(1+\frac{1.393-1}{2}0.85²\Bigr)^{\frac{1.393}{1.393-1}} \notag\\[1ex] p_{0a}=30416.8 Pa \notag ...


1

The math content of the equation environment is already centered, the equation number is either left or right, so there's no need to use an external center environment. The same is true for the \[...\] display math structure. A suggestion with \[....\] and with \begin{align*}...\end{align*} and the numbered align version. In my opinion the align(*) ...


1

No, \hfuzz doesn't affect the line breaking decisions. TeX will use a sequence of line breaks so that no line is overfull/underfull, if it's able to find one. Otherwise it will use the sequence the least amount of demerits even if a line is overfull/underfull; the value of \hfuzz only affects the console/log output: if a line is overfull beyond \hfuzz, ...


1

I could not get things to compile, so I converted to Latin text and compiled with pdflatex. But, since your background lines did not require autowrapping, I suggest the use of the stackengine package: \documentclass[12pt,sanskrit]{memoir} \usepackage[b6paper]{geometry} \usepackage{graphicx} \usepackage[pages=some]{background} %\usepackage{xunicode} ...



Only top voted, non community-wiki answers of a minimum length are eligible