How to change cross-reference language in Quarto?
Take the example in docs:
![Elephant](elephant.png){#fig-elephant}
See #fig-elephant for an illustration.
In the .tex file it is shown as (Figure~\ref{fig-elephant}). Rendering, result is something like see Figure 1 for an illustration.
How can I change Figure for any other word?
You can use fig-prefix option to change the inline reference prefix and also fig-title option to change the figure caption accordingly.
See here in Quarto Documentation to know more options to change the reference style.
---
title: "Cross Reference Prefix"
format: pdf
crossref:
fig-prefix: "Picture"
fig-title: "Picture"
---
## Quarto
![Elephant](elephant.png){#fig-elephant}
See #fig-elephant for an illustration.
Related
In this video at around 7:30 into the video, Yihui Xie make a demo of the package coffee4 which adds random coffee stains to a document. However, he is showing them in a regular LateX style pdf. I am wondering if I could also use this package or an adopted version of it when creating a pdf in the style of tufte-handout. Grateful for help on how I should go about in order to achieve such a result. In particular I am wondering how to download and install the coffee4 package in RStudio and what to write in the YAML or in R code in the document itself.
If you place coffee4.sty somewhere latex can find it, e.g. the same folder as your .rmd file, then you can use it like this:
---
title: "An Example Using the Tufte Style"
author: "John Smith"
output:
tufte::tufte_handout: default
header-includes:
- \usepackage{coffee4}
---
\cofeAm{1}{1.0}{0}{5.5cm}{3cm}
test
I'd like to add a code appendix to my LyX document. There are a few options I already considered, but they all have their problems.
I know a bit about listings, but one problem with those is that, if I copy & paste my code into them, I lose all enters/newlines. Since the code is too large to correct by hand, I was wondering if there is an alternative.
In LyX there is the possibility of inserting child documents, but that seems to be only for .tex files. Would have been ideal if I could just insert my .java file as a child document.
I could print the code to PDF, but it will include margins that mess up the final document, since the PDF is placed on the left margin of the final document and then there is the margin of the PDF. Also, this PDF always contains the entire code and white areas where not the entire page has been filled.
Does anyone have good alternative?
The listings package found here
http://www.ctan.org/tex-archive/macros/latex/contrib/listings/
allows the include of external source code files (look into the reference for \lstinputlisting).
EDIT: here you find some samples how to use it:
http://en.wikibooks.org/wiki/LaTeX/Packages/Listings
If you need to copy-paste code to LyX listing box then use Edit -> Paste Special -> Seletion or Ctrl+Alt+V.
For what it's worth, at least the 2.0 versions of LyX have the ability to include listings as child documents. Insert, File, Child Document, and choose from the dropdown box "Program Listing". This uses the listings package and lets you keep your source in its own file.
If listings doesn't support your language, you can always use something like highlight or source-highlight to generate a latex snippet of syntax-highlighted code that you can add as a child document of type "Input"
Yes, if you copy&paste code into the LyX listings box, you lose all newlines, but you can preprocess your code (insert an extra newline below each line):
$ cat foo.java | sed -e 's/$/\n/' > bar.java
Then you can copy&paste the new file bar.java and everything will be ok.
The latex hyperref package makes a really nice, linked table of contents, named according to section name. However, the top level category is by default, the file name. It seems I should be able to change this to the actual title, but I'm not finding any information on how.
Are you sure this is not a 'feature' of your PDF reader? It might try to use the PDFs title (unset by default), which you can set like this:
\hypersetup{
pdftitle = {The title},
pdfauthor = {You}
}
You might also want to check out the TeX StackExchange.
At the top of my tex document, I set my sourcecode listing format by
\lstset{language=java}
\lstset{numbers=left, numberstyle=\tiny, numbersep=5pt, breaklines=true}
\lstset{emph={square}, emphstyle=\color{red}, emph={[2]root,base}, emphstyle {[2]\color{blue}}}
because I merely list Java source code.
At one point in my document, I had to reformat for a single listing by
\lstset{commentstyle=\footnotesize\textit}
\lstset{basicstyle=\ttfamily\fontsize{11}{12}\selectfont}
\lstset{literate={!=} {$\neq$}{2}}
Now I have the problem that my previous Java formatting for listings is destroyed, and I dont know how to reset the lst settings to default.
How can this be avoided?
If you need to modify only one listing, you can pass the options as an optional argument:
\begin{lstlisting}[commentstyle=\footnotesize\textit]
...
\end{lstlisting}
will only affect that particular listing.
When I build the LaTeX file generated from sphinx, the TOC entries, and section headers are blue. Is there an easy way to disable coloring these items? If not, is there an easy way to make them black instead? My goal is to print the document on a non-color printer, and the TOC and headings do not look as dark as the rest of the text when I do so.
I would like to make one change that applies to the whole document if possible.
Note: I am using the howto document class.
Update
Thanks to ddbeck's input, I took a closer look at sphinx.sty which defines the colors that I needed to change. I set (created) the latex_elements dictionary in conf.py as follows:
mypreamble ='''
\\pagenumbering{arabic}
\\definecolor{TitleColor}{rgb}{0,0,0}
\\definecolor{InnerLinkColor}{rgb}{0,0,0}
'''
latex_elements = {
'papersize':'letterpaper',
'pointsize':'11pt',
'preamble':mypreamble
}
This worked out exactly as I wanted it. Thanks ddbeck!
You can add LaTeX by using the latex_elements['preamble'] configuration option. If you change the value of that key, you can override Sphinx's normal LaTeX. The docs on this option aren't particularly illuminating, however. You may find this thread from sphinx-dev a bit more helpful; it has more detail on how that might be used, as well as some good links for learning about LaTex (if that's something you need to get black and white output). Finally, it might help to take a look at the default .cls and .sty files.