reStructured Text - Escape a headline? - restructuredtext

I have a reStructuredText document. rST uses =====, etc. as a heading format.
However I need to include some lines that have this text in it, e.g.:
some of my text
=====
stuff
=====
some more of my text
And I don't want the ==== to be interpreted as a heading, i.e. I don't want stuff to be a heading. I would rather that those equal signs are just displayed as is.
Is this possible in rST?

The escape character in reStructuredText is \:
some of my text
\=====
stuff
=====
some more of my text
Will be rendered as:
some of my text ===== stuff ===== some more of my text

Related

Right justify a single line of text in RMarkdown

I know its possible to change text justification and other setting when RMarkdown generates Word documents using a template.enter link description here.
Is it possible to change the justification of a single line?
For example, text that looks like
Some normal left justified text
some right justified text
Some more left justified text
Flushright works if your output format is .pdf but not for .html or word document.
Some normal left justified text
\begin{flushright}
some right justified text
\end{flushright}
Some normal left justified text
It seems to be important to leave the lines in between empty.

Underline the single line of text from the paragraph in PHPEXCEL

How to underline a single line of text from the paragraph in the single column using PHPEXCEL
Try this
for native php
$objPHPExcel->getActiveSheet()->getStyle('b4')->getFont()->setUnderline(true);
for Codeigniter
$this->excel->getActiveSheet()->getStyle('b4')->getFont()->setUnderline(true);
If it's just a single block of text in a cell, and not the entirety of the content of the cell, then you need to define the content of that cell as Rich Text
There's an example of setting a cell with Rich Text in /Examples/02types.php
$objRichText = new PHPExcel_RichText();
$objRichText->createText("Hello ");
$objUnderlined = $objRichText->createTextRun("underlined");
$objUnderlined->getFont()->setUnderline(true);
$objRichText->createText(' World.');
$objPHPExcel->getActiveSheet()
->getCell("A1")
->setValue($objRichText);

QTextDocument Newline handling and eliding

I am using QTextdocument and in my text there are "\n" for new line characters but QTextDocument is not handling it and it shows it as plain 1 line .
Is there any way we can make it handle "\n" as new line character, along with that I need eliding also.
So whenever any text is there after line break it should show "..."
E.g. This
is
the
Sample
Currently QTextdocument removed line breaks and shows it as "This is the sample"
2nd issue is for eliding Now suppose only 1 line is visible it should show it as "This..."
How do I achieve this?
QTextDocument holds formatted text, so you can use <br> html tag for a new line and set it's content using QTextDocument::setHtml.
Also you cab use QTextDocument::setTextWidth to set a specific width for text in the document. If the content is wider, it is broken into multiple lines and grows vertically.
About eliding you can see this bug report which is unresolved.

Respect space in code but ignore with CSS?

With CSS can I make a browser ignore the character but respect normal white space?
So this:
Some text More text
Is displayed like this:
Some text More text
Not:
Some text More text
UPDATE There is actually more white space in my code. I need the default behavior where extra white space doesn't get rendered on the page so I dont think I can use white-space: pre or pre-wrap
So this shouldn't be excessively indent before the initial word.
Some text More text
I don't think there's a pure CSS way of doing that, since is an actual character that is different from the whitespace created by the spacebar in a text editor (what gets ignored by HTML renderers). However, depending on how those are appearing, you may be able to use a script that searches for and removes that character wherever it sees it.

Subsections in reStructuredText

I'm trying to write a document in reStructuredText, but am currently facing a problem.
I want the document to have a title, this is going to be centered, then immediately after that I want a subsection.
I tried doing the following
##############
Title
##############
+++++++++
Subtitle
+++++++++
content
But when I convert this to PDF, it makes both the title and subtitle centered.
From the reStructuredText quick start guide titles and sub-titles are specified as follows (emphasis mine):
To indicate the document title in reStructuredText, use a unique adornment style at the beginning of the document. To indicate the document subtitle, use another unique adornment style immediately after the document title.
So in the reST example in the question, Subtitle is being formatted as a sub title and not a section heading since the adornment style used around Subtitle is not used anywhere else in the document. In the following, this adornment is used around two section headings, so is not unique and not treated as a subtitle:
##############
Document Title
##############
+++++++++++++++
Section 1 Title
+++++++++++++++
Section 1 content...
+++++++++++++++
Section 2 Title
+++++++++++++++
Section 2 content...
Have a play with http://www.tele3.cz/jbar/rest/rest.html This allows you to quickly try out some simple reStructuredText and test things like sub-titles vs. section titles.
Edit: Alternatively you could put some text between your title and section heading (like an abstract, for example).
P.s. I tend you use adornments above and below a heading to indicate a document title and sub-title and a single adornment below a heading to indicate a (sub-)section title. This makes it easy to see what I intended to be my title/sub-title. For example:
==============
Document title
==============
-----------------
Document subtitle
-----------------
Section
=======
Sub-section
-----------
etc.
I think it's quite natural to have a subsection start immediately under a section heading, as in
MY THINGS
My First Thing
...
My Second Thing
...
A work-around I found by trial and error is to put "\ " (backslash-space) as null content between the section heading and the subsection heading. With rst2html this has the desired effect without introducing any unwanted space.

Resources