Non-breakable expression without overflow - latex

How to insert in a paragraph an expression that won't be cut by a new line, and that won't overflow in the margin either?
I would like the expression to try staying on the same line, but to go on the next one if there is not enough space (rather than overflowing).
\documentclass[a4paper]{article}
\usepackage[english]{babel}
\begin{document}
Lorem ipsum dolor sit amet, [expression that won't break no matter what] consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua.
\end{document}
I checked LaTeX: Prevent line break in a span of text but \mbox makes an overflow in the margin, and https://tex.stackexchange.com/questions/29257/how-to-prevent-latex-from-line-breaking-a-phrase also does. I also tried \begin{sloppypar}...\end{sloppypar}, but it always makes a new line, even when not necessary.
This would be an equivalent to CSS' inline-block I guess.

Related

How to make Quarto Revealjs presentation text full width?

I am creating a Quarto Revealjs presentation. How can I make the text full width? I.e., reduce the left margin and right margin to 0?
The default margin (0.1) and width (1050) can be adjusted using presentation size options:
---
format:
revealjs:
width: 3000
margin: 0
---
## Quarto
Quarto enables you to weave together content and executable code into a finished presentation. To learn more about Quarto presentations see <https://quarto.org/docs/presentations/>. Food truck fixie locavore, accusamus mcsweeney's marfa nulla single-origin coffee squid. Exercitation +1 labore velit, blog sartorial PBR leggings next level wes anderson artisan four loko farm-to-table craft beer twee. Qui photo booth letterpress, commodo enim craft beer mlkshk aliquip jean shorts ullamco ad vinyl cillum PBR. Homo nostrud organic, assumenda labore aesthetic magna delectus mollit.
Output:

Graphviz: aligning a graph wrt its label

By default, Graphviz centers the graph relatively to its caption (label):
graph {
label="lorem ipsum dolor sit amet consectetur adipiscing elit"
A -- B
}
How can I align the graph to the left, i.e., make A, B and the initial of "lorem" vertically aligned?
The attributes labeljust and labelloc have other purposes, and I cannot see anything in the reference to achieve this result.
(it helps it include your source as text, not png)
No direct way, but (if needed) use invisible nodes and/or node width to get the graph wide enough to meet your needs. Then use the labeljust attribute to to justify the label to the left (or right) of the entire graph.
graph {
// does not seem to work size="8!"
label="abcdefghijklmnopqrstuvblahblah" labeljust=r
{rank=same a node[style=invis width="2."] x1 x2 edge[style=invis] x1--a--x2}
a--b
}
giving:

highcharts additional title opinion

I wanted to ask an opinion about adding an additional title to highcharts header.
Highcharts provides 2 (title and subtitle) by default, but what we are trying to do is to add one more title (dek) between them.
we solved it by adding breaks but fixing spacings killing me.
Also, we have specs and they should be strictly followed (every px counts).
PROBLEM : There are different properties that affecting titles such as chart.spacing[0], title.margin, svg y properties that we are trying to manipulate manually.
Also in our case titles are dynamic, they could be structured in different ways
include only Title
only dek (in-between title & subtitle)
only subtitle
Title & dek
Title & dek & subtitle
title & subtitle
dek & subtitle
In addition to that, we produce different types of charts. So it's a lot of conditions. Same thing with credits, we have multiple lines, but text doesn't wrap automatically (as it does for headers), I had to manually count how many characters could fit for particular width(styled mode).I feel it's not supposed to be this way and I really need to figure out how to solve it. That would be great to get an opinion from someone's who actually works in highcharts. Thank you!
Here is an example:
.
You can set useHTML proeprty to true and style the part of the title as you want:
title: {
useHTML: true,
align: 'left',
text: `
Lorem ipsum dolor sit amet <br>
<span class="titleSpan">Integer quis pharetra tellus. Cras tincidunt libero id dignissim convallis. Class aptent taciti sociosqu ad litora torquent per conubia nostra, per inceptos himenaeos.</span>
`
},
subtitle: {
align: 'left',
text: 'Sed aliquam ligula in pretium lobortis.'
}
Live demo: http://jsfiddle.net/BlackLabel/ad3reo8b/
API Reference: https://api.highcharts.com/highcharts/title.useHTML

How doesn't UILabel implementation intrinsicContentSize?

As we known, UILabel has intrinsicContentSize, my puzzle is when we pin a label to it's superview with leading and trailing offset 10 for example, and set the numberOfLines to 0, assume the superview is a viewcontroller's view that has a width 320, and how label knows it's width is 300.
Another, when there are mutiple constraint that the label is compressed, and how the label know it's compressed and recalculate it's size?
The intrinsicContentSize is independent of any context, including any constraint applied to the label. This is, actually, the meaning of intrinsic.
So when you ask for the intrinsicContentSize of a label, it does not know that its width is gonna be 300, and indeed it returns any width that fits its content. Go on, check it: ask the the intrinsicContentSize of a label which contains "foo", or "Lorem ipsum dolor sit amet, consectetur adipiscing elit. Vestibulum vitae sapien nec elit tongue incident." You won't get the same result.
Know you may wonder: if the intrinsicContentSize is (52,21) or (633,21), why on earth does it end at (300, 21)?
Well the answer is simple: the intrinsicContentSize generates implicit constraints whose priorities are controlled by the contentHuggingPriority and contentCompressionResistancePriority of the label. Those are generally less than 1000. On the opposite, the priority of the leading and trailing offsets are 1000, the maximum. So the offset constraints win in the final layout, and the label ends with a 300 width.
Now try to set contentHuggingPriority and contentCompressionResistancePriority to 1000: you will see a conflict. Do you see why?

Apply lineBreakMode on a sub portion (2 lines) of my UILabel (4 lines)

In short: how to apply a lineBreakMode on a sub portion (say 2 lines) of a UILabel (say 4 lines).
In long:
Click here to see a screenshot of the App Store in iOS7.
I have a UILabel of 4 lines (in red). I assume this is a UILabel on the screenshot because they are all centered vertically in every UITableViewCells.
This UILabel is composed of a substring that's is truncated on 2 lines max (in blue).
Just spent one entire day on this question and I didn't even found a beginning of solution. If somebody can help...
Here is another example. This is a UILabel:
+------------------------------------------+
| |
|Lorem ipsum dolor sit amet, consectetuer |
|adipiscing elit, sed diam nonummy nibh |
|euismod tincidunt ut laoreet dolore magna |
|aliquam erat volutpat. |
|Line 2 |
|Line 3 |
| |
+------------------------------------------|
I want it to be displayed in this form (with the first sentence truncated in two lines):
+------------------------------------------+
| |
| |
|Lorem ipsum dolor sit amet, consectetuer |
|adipiscing elit, sed diam nonummy nibh... |
|Line 2 |
|Line 3 |
| |
| |
+------------------------------------------|
You need to create your own UITableViewCell, add the views you want to it, and add it to the table. Check this:
Customizing UITableViewCells
As you said, what you are trying to achieve seems quite complicated, at least not possible without CoreText (and not sure if possible with it).
Basically, when configuring a UILabel, you can choose two properties, the lineBreakMode, that tells you how the lines are truncated, and the number of lines, but for the whole label.

Resources