I tried to change the "List of Listings" text with the command
\renewcommand*{\lstlistlistingname}{List of XYZ}
before my \begin{document}. What's wrong with this?
By the way
\renewcommand*{\lstlistingname}{NewListing}
worked like a charm.
Edit: No error occurred, just no change in the text. It's still "List of Listings".
By the way this is how I included it:
\pagestyle{scrheadings}
\pagenumbering{Roman}
\pdfbookmark[0]{\contentsname}{Contents}
\tableofcontents
\listoftables
\listoffigures
\listoflistings
\pagestyle{scrheadings}
\pagenumbering{arabic}
I've seen that on the "List of Listings" page the numbering starts with "1" but it should be a "V". Some hints?
Thank you
Use \lstlistoflistings
\listoflistings is from the listing package. \lstlistoflistings is from listings package (Notice the plural). You should not use both at the same time.
If you are using the listing package, use
\renewcommand*{\listlistingname}{List of XYZ}
to change the heading.
EDIT: From the fact that \lstlistingname works I conclude that you use the listings package. I suggest to remove the line \usepackage{listing} from your tex file. If you use both packages: Just use the right commands. Listings from both package appear in both put the entries into the same lol file.
Just tried to change it myself. There is a separate command that provides the name. E.g.:
\renewcommand{\lstlistlistingname}{My listungs}
so both \lstlistingname and \lstlistlistingname need to be changed.
For answering your page numbering question:
Insert a \cleardoublepage just before \pagenumbering{arabic}. That should fix the roman numbering on your List of listings.
Non of above answers worked for me. The commands that solved my issue were:
\renewcommand{\listingscaption}{Code}
\renewcommand{\listoflistingscaption}{List of source code examples}
Note: the commands above are for the Listing package, not for the Listings package!
Related
I have a problem with my biblatex. My booktitles don't automaticly break lines in my bibliography. Has someone got a hint how to solve this? Is it possible to get an automatic break or do I have to set them manually? And if I so, how do I do that?
Here my biblatex code snippets:
\usepackage[backend=biber,style=authoryear,sorting=nyt,citestyle=authoryear]{biblatex}
\printbibliography[type=book,title={Books}]
See this example at IEEE: after Metrics is a linebreak is missing.
EDIT: I found the solution here
I was curious about the \emph{} style (mine was always underlining). I put a single \normalem in front of the \printbibliography command and it works fine :)
\normalem
\printbibliography[type=book,title={Books}]
Your book titles are underlined, which is preventing line breaks (underlined text doesn't break). I don't think this is a standard behavior, book titles are usually displayed in italics. Perhaps you are using \underline{} inside your bibliography items definitions?
I am using these commands for including references:
\addcontentsline{toc}{chapter}{References}
\bibliographystyle{agsm}
\bibliography{dissrefs}
The problem is that in the table of contents both References and Bibliography appear, while I just want one to appear. Why is this happening? Can I customise the table of contents entry to be just one of them?
I am using MikTex 2.8 and TexMaker 2.1.
I dont think that you need to use \addcontentsline{toc} bibtex should do it automatically. At least I don't recall ever needing it...
Have you tried commenting out that line?
Edit regarding OPs comment on changing the title of the bibliography:
The bibliography's title can be changed by (to for instance "New Title") using \renewcommand\refname{New Title} for articles and \renewcommand\bibname{New Title} for books.
Instructions are read and processed in the order they appear, I think your problem is related to that order. Try moving things around (I believe that all settings should be put before \tableofcontents, but I'm not sure about that, I'v not used latex for a long time)
I made a table of contents using \tableofcontents Each section is made using \section yet when I do \subsection it is not listed in the table. How do I get it to list there? Thanks.
Which document class are you using? I just tested it for article, and it works fine. In any case, try using this in the preamble:
\setcounter{tocdepth}{2}
Increase 2 if you want to list subsubsection, etc.
Add:
\setcounter{tocdepth}{5}
to the preamble.
See: http://www.devdaily.com/blog/post/linux-unix/latex-setting-table-of-contents-toc-depth
#WhirlWind and #Steve_Tjoa got it and helped me too! One thing though, whatever you set the tocdepth counter to, you may also want to set the secnumdepth.
so i used
\setcounter{tocdepth}{5}
as suggested by #Whirlwind but then the subsubsection in my Table of Contents wasn't numbered. so I added the following to get it to work (thanks to the following link where i found the answer http://www.latex-community.org/viewtopic.php?f=5&t=2351#p9197 )
\setcounter{secnumdepth}{5}
I'm trying to centre the title of the table of contents in LaTeX with the following command
\usepackage{tocloft}
\renewcommand{\contentsname}{\centering Table of Contents}
As I'm asking I'm sure you've all realised that this didn't work, any suggestions on what I can try?
Edit: I got it working with
\renewcommand{\cfttoctitlefont}{\hfill\Huge}
This works (without the usepackage):
\renewcommand{\contentsname}{\centering Contents}
Make sure it's in the preamble, perhaps, and try killing the .aux file.
This works in \documentclass{book}, without needing the usepackage:
\renewcommand*\contentsname{\hfill Contents \hfill}
\tableofcontents
It should even work if the \renewcommand is immediately before the \tableofcontents command.
Renewing contentsname may fail because of how \begin{document} rewrites components from babel, such that the commands must be added to \captionsenglish. This post goes into more detail.
\usepackage{tocloft}
\addto\captionsenglish{\renewcommand{\contentsname}{Table of Contents}}
\renewcommand{\cfttoctitlefont}{\hfill\normalsize}
\renewcommand{\cftaftertoctitle}{\hfill}
I have a problem concerning the listings package in latex. I need to embed a source code of the following XML document http://www.sparxsystems.com.au/downloads/profiles/EP_Extensions.xml in my master thesis' appendix. The problem is, no matter what options I pass to the package, I don't seem to be able to fit it on the page. The lines in the listing are too long, and the listings package doesn't wrap them, which seems odd... What combination of options will do the trick?
At the moment I use the following lstset instruction:
\lstset{
breakindent=0em,
language=XML,
basicstyle=\footnotesize,
numbers=left,
numberstyle=\footnotesize,
stepnumber=2,
numbersep=5pt,
backgroundcolor=\color{white},
showspaces=false,
showstringspaces=false,
showtabs=false,
frame=single,
tabsize=2,
captionpos=b,
breaklines=true,
breakatwhitespace=true,
breakautoindent=true,
escapeinside={\%*}{*)},
linewidth=\textwidth
}
Which, with no other options set, and combined with the following command:
\lstinputlisting{EP_Extensions.xml}
Lists the given file's source to the following output:
I just had this problem...
breaklines worked for me, though you do need to set it to true - the default is false:
\lstinputlisting[style=Python,
caption=My Class,
label={mine.py},
breaklines=true,
]{../python/mine.py}
is pretty much what I used
I had this problem and this page ranks highly on google so here was the solution for me:
I had the following inclusion: \usepackage[none]{hyphenat} which causes the issue described above. I was using it to fix the problem of latex automatically breaking lines in the middle of a word, which looks really stupid in some circumstances.
After much searching for an alternative to this solution I found nothing suitable and settled for properly broken lines but badly placed hyphenation.
Not a great answer, but one idea is to word wrap the source code before including it. If you're on linux, the command fold can be used for this. Clearly this works best if the text is in a fixed width font, which i would recommend in any case for code listings.
A followup to Aaron's answer. I was using basicstyle=\ttfamily for my listings. I was therefore able to permit line breaking by changing
\usepackage[none]{hyphenat}
to
\usepackage[htt]{hyphenat}
% ^^^
The hyphenat docs describe that the htt option "enables hyphenation of ... text typeset via either \texttt or \ttfamily." In my use case, I didn't see any hyphenation in my listings, but I did get the breaking.