How to change title in listings? - latex

I have a question about the listings package. Do you know how to change it to get a title like this "Algorithm ## Title" rather than the casual "Listing ## Title" in the title line?

Put these lines to preamble (the preamble is everything from the start of the LaTeX source file until the \begin{document} command):
\renewcommand\lstlistingname{Algorithm}
\renewcommand\lstlistlistingname{Algorithms}
The first changes the caption name for listings. The second — the header name for the list of listings which is printed by the \lstlistoflistings command. You would also probably want to modify the text in autorefs:
\def\lstlistingautorefname{Alg.}
Then when you're referring to a particular listing, e. g. For details see \autoref{sec2:bubblesort}. it is written as "For details see Alg. 2.1."

Related

Biblatex: print autor names respecting maxcitenames in bibliography styling

I need to create a bibliography style based on authoryear, which precedes the entry with its original citation label. I know that I can set the additional style somewhat like this.
\renewbibmacro*{begentry}{%
\printnames{labelname} \usebibmacro{date+extradate}\\
}
But this will give me a different line, if maxcitenames and maxbibnames are set to different values. By example, if I have maxcitenames set to 2 and maxbibnames set to 99, I will get "Dehmel et al 2020" for citing and "Dehmel / Kenning / Wagner 2020" in the first line of the bib entry (respecting that I'm using '/' as the author delimiter). I want both to be the same, without changing maxcitenames, as the second line of the bib entry would be affected by this and no longer show all and full author names. Is there a field or bib macro that I can use to access the original label? I know that this bib style is unconventional, but the style is not my decision.

how to omit spaces in overleaf latex reference

I am using the below reference in .bib file overleaf project
#MISC{104,author = {W. R. Group},title = {Auckland II},howpublished = {https://wand.net.nz/wits/auck/2/auckland\_ii.php.}, year = {2020}, month = {Accessed on: July, 1}}
However, I get spaces in my references as shown in the link below
reference output
Two problems:
you shouldn't set urls as normal text. Use the \url{...} macro from the hyperref or url package instead
Once you have done this, you can use the xurl package to provide more possible break points and thus avoid such spaces
Unrelated comment:
the month field is not the right place to give additional information like Accessed on: July, 1. If you'd choose an appropriate entry type instead of #misc it would have its own field for this, e.g. urldate

Google Sheets: How do I include a newline within a field in a local .tsv file I want to import

I know that in Google Sheets I can type Control-Return to create a sort of "phantom" return that starts a new line within a field. But what is the actual character that represents this? Obviously it's not ASCII code 13, as that is the record separator.
I would like to be able to include this mystery character in a local .tsv file which I import into Google sheets, so that these multi-line fields will display as such. Is this possible?
Thanks!
it's CHAR(34)
so something like the following in a cell would give two distinct lines of text...
="direct text input"&A3&" more text"&CHAR(34)&"Newline with new text"
Q: Google Sheets: How do I include a newline within a field in a local .tsv file I want to import
A: Surround that field with "
Update: Only when working with CSV. Google Sheets TSV doesn't seem to include the 'new lines'. More info on the link at the end.
In technical drawing class I learnt that if you don't know how to get A-->C, try to go C-->A and draw conclusions to help you achieve your goal.
If you have this CSV text file
The google sheet will look like this
Which I obtained going the other way around.
If surrounding the field with " is not possible, you may want to use this formula, which does the opposite (changes 'new line' for § ) [adapt to your needs].
# For a whole column, if there are 'new lines' in the cell,
# copy the cell changing them to '§' otherwise copy the cell 'as is'
={"description";ArrayFormula(IF( REGEXMATCH(G2:G; char(10)) ; REGEXREPLACE(G2:G;char(10);char(167));G2:G))}
More rambling here
Inspired by #MattKing's answer, an import of a *.tsv file containing this example content (note the double-quoting within the 2nd column value) ...
"example value with no line breaks" "=""line one""&CHAR(10)&""line two"""
... seems to have the desired outcome ...

Include custom text within citation

I would like to add custom text right after citation year within a reference without a comma. For example, I need (UNISDR, 2016:18) to indicate the exact page number of the reference.
To add custom text of ":18" right after year, I add following into my latex citation:
\citep[:18]{UNISDR:2016aa}
Then the result becomes (UNISDR, 2016, :18). I need to get (UNISDR, 2016:18) without a comma and a space after year.

Remove section number but display the number in table of contents in LaTeX

I am new to LateX. I know how to remove the section number by using \section*{heading} instead of \section{heading}.
But when I display the section heading in the Table of Contents , it does not print the section number. I want the section number to be displayed before "Introduction to Project" and "Introduction to company" in the Table of Contents shown below.
The titlesec package is very useful to modify your chapter and section titles. An important command is \titleformat, which is described on page 4 of the manual. The command looks like this:
\titleformat{⟨command⟩}[⟨shape⟩]{⟨format⟩}{⟨label⟩}{⟨sep⟩}{⟨before-code⟩}[⟨after-code⟩]
here, we want to change the \section command, i.e. <command> is \section.
The <shape> setting is optional - we'll just leave the default value. In <format>, we define how the title shall be formatted. The default for \section is \normalfont\Large\bfseries, so we'll set it to that. If you want to change the appearance, you can do that here. Now, the interesting part: the <label> is the section number - we don't want to print it, so we'll lave that field empty. The <sep> is the separation between label and title, which should be zero if we don't have a label. Finally, with <before-code> and <after-code> we can add any code which should be run before or after printing the title. We don't need that either. So, our command is:
\titleformat{\section}{\normalfont\Large\bfseries}{}{0pt}{}
Here, a demonstration of that:
\documentclass{article}
\usepackage{titlesec}
\titleformat{\section}{\normalfont\Large\bfseries}{}{0pt}{}
\begin{document}
\tableofcontents
\section{Introduction to Company}
This is the company.
\section{Introduction to Project}
My project is very nice.
\end{document}

Resources