I would like to justify the text in a Quarto document. This means that it should automatically add text between words so that both edges of each line of text are aligned with both margins. In a word-document this would be the following highlighted symbol:
So I was wondering if this method is possible in a Quarto document? Here is a reproducible example:
---
title: "How to justify text in Quarto"
format: html
editor: visual
---
## Quarto
Quarto enables you to weave together content and executable code into a finished document. To learn more about Quarto see <https://quarto.org>.
Quarto is based on Pandoc and uses its variation of markdown as its underlying document syntax. Pandoc markdown is an extended and slightly revised version of John Gruber's Markdown syntax.
Markdown is a plain text format that is designed to be easy to write, and, even more importantly, easy to read:
Output:
As you can see the text is not justified, because the lines of text are not all at both edges of each line with both margins.
Since output format is HTML, all you need the CSS property text-align set as justify.
---
title: "How to justify text in Quarto"
format: html
engine: knitr
---
```{css, echo = FALSE}
.justify {
text-align: justify !important
}
```
## Quarto
::: {.justify}
Quarto enables you to weave together content and executable code into a finished document. To learn more about Quarto see <https://quarto.org>.
Quarto is based on Pandoc and uses its variation of markdown as its underlying document syntax. Pandoc markdown is an extended and slightly revised version of John Gruber's Markdown syntax and Markdown is a plain text format.
Markdown is a plain text format that is designed to be easy to write, and, even more importantly, easy to read:
:::
Related
In python-3.x with tkinter GUI, I developed a program with a regular simple window.
I want to show a markdown format string saved in a string called markdownText on program window:
markdownText='_italic_ or **bold**'
desired output is:
italic or bold
Is there any solution?
I was just searching for a similar solution, and it does indeed not seem like there is a default module/class/library for the combination of Python, TkInter and markdown. However a continued search revealed the following options:
Python-Markdown – This a module capable of parsing markdown into the following output formats: Python-Markdown can output documents in HTML4, XHTML and HTML5.
TkInter displaying html – As the linked answer indicates, Tkhtml can display html "pretty well", and it has a python wrapper
In other words, if you are willing to use an intermediate step of converting into html that might be a viable route for you to display markdown strings within a tkinter GUI.
Second level bullets in markdown are "-" when converting to pdf. I would like to change them to some other type of bullets (disc or triangle for example). Is there something I can pass in to the pandoc command line to change this? Or something to change in the template?
It looks like there are two possibilities, both which would involve passing your markdown through a LaTeX style file like so:
pandoc -H format.sty -o foo.pdf bar.md
The first uses the Beamer template -- see this thread on changing bullet styles in Beamer. The second possibility uses the enumitem package -- here's another thread on changing bullet styles in this manner. So, I imagine your style file could simply contain the the following, for instance:
\usepackage{enumitem}
\usepackage{amsfonts}
\setlist[itemize,1]{label=$\bullet$}
\setlist[itemize,2]{label=$\diamond$}
When pandoc converts to PDF, it will place this LaTeX formatting information directly above \begin{document}.
I cannot use mathjax in MarkDown page as described here and here. I would like to know how to do that?
I can use mathjax in html files now.
It seems that mathjax cannot render the $$ displayformula?
You actually do have MathJax working with the first page that you cite (the other link seems to be broken). If you notice the first equation, it has been typeset by MathJax (note that its contextual menu is MathJax's). The problem is that Markdown is turning your underscores into <em> tags, and that means MathJax won't process those equations (MathJax doesn't process math that contains HTML tags).
One solution is to put spaces around your underscores, so that Markdown will ignore them.
Another would be to use backticks (`) around the math to turn it into "verbatim" mode, so Markdown won't modify its contents. That may cause the math to be enclosed in <code> tags, which MathJax will ignore. So you would need to modify your configuration to include
tex2jax: {
skipTags: ["script","noscript","style","textarea","pre"]
}
(the default has "code" in that list) so that MathJax will process the contents of <code> tags.
Addition:
Your theme styles code blocks with white text on black backgrounds, so you may want to add some additional CSS to set that back. You may be able to do that somewhere in your theme controls, but you could also add
styles: {
code: {
"font-family": "inherit",
"color": "inherit!important",
"background": "inherit!important"
}
}
to your MathJax configuration, and it will set the styles for you. Note that this will also modify how any backticked material will show up. If you want to have it only affect MathJax output, that would take more work.
With this question (of 2010) as a starting point, is there a way to generate a colourful PDF file (via *TeX) such that it would always be printed in black-and-white, iff the printer can't print colours (a black-and-white printer)?
In other words: How "intelligent" is the PDF (ISO) standard?
See ISO_32000-1 and also here.
Edit
The upshot of this "exercise" is not for printing on your own office or home printer, but when you dispatch/publish/release a document and don't know how others on their (unknown) printers will print your carefully crafted document.
PDF is a format of document. So it may not be "intelligent". The PDF standard can not include two different versions of the document (one for color printing and one for printing in black and white).
How do you generate images(*.svg, *.gif, *.png ...) with MetaUML?
MetaUML is built on top of MetaPost, which is a tool used with LaTeX to typeset documents. So the output of the MetaUML is ment as graphics for LaTeX documents, which is a PostScript based vector graphics format similar to EPS. You can find more on the MetaPost wiki page.
However you can convert the resulting file, just google "metapost to svg" for example, first hit is this tutorial: http://www.tlhiv.org/MetaPost/tools/mptosvg/