Force the end of a LaTeX command in MultiMarkDown - latex

I'm using MultiMarkdown to generate a LaTeX file of an academic paper I'm working on. I'm using biblatex for the bibliography, which allows for commands like autocite and autocites:
This is a true statement.\autocite{source:2007}
When autocites is used, each braced entry is considered a citation source, which works great when there are multiple sources for the citation:
This is another statement.\autocites{othersource}{yetanothersource}
However, when the text following the autocites command is another bracketed LaTeX command, biblatex treats it as another source, spacing:
This is another statement.\autocites{othersource}{yetanothersource} {\itshape The New York Times}…
results in a footnote that looks like this:
Bib data for othersource; bib data for yetanothersource; \itshape The New York Times
That's a problem. One obvious way around it is to use a different command for italics, like \emph{The New York Times}, but unfortunately MultiMarkdown uses itshape instead of \emph, and I'd rather not muck around in MMD's source code.
Is there a LaTeX sequence or code that will force a break between the two sequences of braced commands? Forcing a line break with \\ kind of works ({yetanothersource}\\{\itshape), but it creates a new paragraph after the first command. Is there something similar to \\ that will tell the LaTex engine to begin parsing the {itshape} as a new command rather than as part of autocite{}?

This is a hopeless guess, but have you tried \relax?
Something like:
This is another statement.\autocites{othersource}{yetanothersource}\relax {\itshape The New York Times}…

Related

Including doxygen's LaTeX output as an appendix to a larger document

I have a "project book" which uses LaTeX's \documentclass{report} ("report" is like a more compact version of \documentclass{book}). I would like to include into this book an appendix with the Doxygen-generated API documentation for the software in the project.
I have achieved this by setting Doxygen's config options LATEX_HEADER and LATEX_FOOTER to an empty file. This makes the resulting latex/refman.tex have top level commands like: \section{\-Namespace \-Index}, at which point I can wrap this with a top level document like:
\documentclass{report}
\usepackage{doxygen.sty}
% the "import" package helps to find Doxygen files in the latex/ subdirectory
\usepackage{import}
% [...] title page and the rest of the book
\appendix
\chapter{API reference (generated by Doxygen)
subimport{latex/}{refman.tex}
% [...] final stuff
\end{document}
This works reasonably well and I get doxygen.sty with this special doxygen invocation:
doxygen -w latex /dev/null /dev/null doxygen.sty
One problem is that this puts an "autogenerated" header on the entire document (not just on the doxygen appendix). I can get rid of this by editing doxygen.sty (I also rename it for my inclusion, actually) and commenting out the block that starts with % Setup fancy headings.
At this point I have something I can live with, but I would like to go one step further: the "doxygen" style modifies a lot of other aspects of the LaTeX document style, and I like it less.
So my question is (in two levels of excellence):
What would be a minimal set of LaTeX commands to put in a doxygen.sty file that would nicely render the doxygen appendix but not interfere with the rest of the LaTeX document?
Even better, has someone come up with a way of doing
\usepackage{doxygen_standalone}
% [... until you need doxygen]
\begin{doxygen}
% the stuff you need to insert your auto-generated doxygen API docs,
% for example the \subimport{latex/}{refman.tex} that I showed above
\end{doxygen}
This last approach is one I would consider very clean.
I'm hoping there is a really simple answer, such as "this already exists in doxygen.sty as an option, and you missed it!"
rename doxygen.sty to mydoxygen.sty, then modify it by inserting
\newenvironment{doxygen}{... most of doxygen.sty goes here ...}{}

LaTeX - Listings - Code Indention

so I'm working on some kind of homework paper about git and I want to insert some console output examples. I'm working with TextMate.
I have my LaTeX code indented like every other normal source code, to make it more readable.
My question now is, why get listings in my output pdf indented and how do I prevent that.
Some example code:
\begin{lstlisting}
$ git ls-files
README
TU_Logo_SW.pdf
beleg.pdf
beleg.tex
\end{lstlisting}
In my file there is one tab in front of \begin and two in the lines following.
When I run pdflatex the code will be indented with two tabstops in the pdf. Quickfix is to format all the listings without indention in my tex file, but thats pretty ugly ;-(
lstlisting has a key that lets you remove spaces:
\begin{lstlisting}[gobble=4] will remove the first four characters from every input line in the environment. (I think a tab should still count as one character at that point.)

LaTex table numbering

How could I number the tables in my article chapter based ? So I want all the tables in the fifth section to be numbered like "Table 5.1", ..., "Table 5.n".
I tried
\usepackage{chngcntr}
\counterwithin{figure}{section}
\counterwithin{table}{section}
\counterwithin{equation}{section}
but I am having some problems (missing package I guess).
However, I need a simpler solution, without the need to use such packages.
The article class doesn't have chapters. Try the book or report classes - you'll find that the tables and figures are automatically numbered according to chapter.
Here is a solution without the use of any package (courtesy of "The Latex Companion", A1.4):
\makeatletter
\renewcommand{\thetable}{\thesection.\#arabic\c#table}
\#addtoreset{table}{section}
\makeatother
This resets the table counter whenever a new section is started, and formats it as sectionno.tableno instead of just tableno. You can change the figure and equation counters similarly.
If you are using the amsmath package (or an AMS class like amsart that loads it automatically), you can use
\numberwithin{table}{section}
This was created for equations, but works for any pair of counters though supposedly there might be tricky situations that it does not handle well.

How do I cite the title of an article in LaTeX?

I'm using LaTeX and BibTeX for an article, and I want to able to cite the title of an article I reference. What is the command to do this?
I'm using \bibliographystyle{chicago} and it does not appear to be \citeT{}, \citetitle{} or \citeTitle{}
#Norman, and the various commenters, are correct in that it would be difficult to do this with bibtex and other tools. But, there is an alternative. Biblatex does allow this through the command \citetitle. Also, if you really want to, the formatting drivers in biblatex are easily readable and modifiable, but only if you feel the need. Unfortunately, it is not part of any distribution, yet, so it has to be downloaded and installed.
Just type in the title. Even natbib, the most powerful widespread BibTeX package, is not powerful enough to do what you want out of the box. Trying to get BibTeX to extract the title for you, by means of a LateX command, is possible, but it would require that you
Design a new format for bibliography items that is incompatible with existing formats.
Write your own custom .bst file, using the very strange postfix language that is used only by BibTeX, to be compatible with your new format.
Write a new LaTeX command to pull the title information out of the new format.
Speaking as someone who has written several custom bst files as well as a replacement for BibTeX, it's just not worth fooling with. After all, if you are citing the paper, you probably know the title anyway.
EDIT: If you have to do this with multiple papers, I would try to cheat. Extend the bst file so that it writes into the bbl file a command that writes into the aux file the title associated with each bibkey. You can model the bbl command on \label and the actual title-citing command on \ref.
This is how I solve the title issue for cited papers:
In the preamble
include Natbib:
\usepackage[sort&compress]{natbib}
If you want to cite a TITLE instead of an author in the text you define the title like this in the preamble:
\defcitealias{Weiser1996designingcalm}{Designing Calm Technology}
Note:
You need to have a bibtex item (for the title ''Designing Calm Technology'') with the key {Weiser1996designingcalm}.
In the paper where you want to write the cited paper's title
\citetalias{Weiser1996designingcalm}
this results in => Designing Calm Technology (i.e. the text you specified with the \defcitealias command above)
or
\citepalias{Weiser1996designingcalm}
that results in => (Designing Calm Technology) (i.e. title with parenthesis)
This question is old and maybe \citefield was not around back in the days, but now it works like charm for this kind of problems:
\documentclass[varwidth]{standalone}
\usepackage{biblatex}
\begin{filecontents}{\jobname.bib}
#article{example,
title = {NAME OF PAPER},
}
\end{filecontents}
\addbibresource{\jobname.bib}
\begin{document}
\citefield{example}{title}
\end{document}
Got it from this question.
Thanks to Anders for the hint. \defcitealias seems to be the way to go.
Bibtex produces a .bbl file which contains the bibliography entries. something like that
\bibitem[\protect\citeauthoryear{Andrienko
{\itshape{et~al.}}}{2003}]{Andrienko2003}
Andrienko, G., Andrienko, N., and Voss, H., 2003. {GIS for Everyone: The
CommonGIS Project and Beyond}. {\itshape {In}}: {\itshape {Maps and the
Internet}}., 131--146 Elsevier.
I use Eclipse, which is free and that you may already have to apply regular expressions in this file when needed. '\R' acts as platform independent line delimiter. Here is an example of multi-line search:
search:
\\bibitem.*(\R.*)?\R?\{([^{]*)\}\R^[^\\].*\d\d\d\d\.\s([^\.]*\R?[^\.]*)\R?.*\R?.*
and replace:
\\defcitealias{$2}{$3}
(For myself I use \\bibitem.*(\R.*)?\R?\{([^{]*)\}$\R^([^\\].*[^\}]$\R.*$\R.*) to get all the item text)
Et produces a series of \defcitealias that can be copypasted elsewhere:
\defcitealias{Andrienko2003}{{GIS for Everyone: The
CommonGIS Project and Beyond}}
Finally, this can be used to build a custom command such as:
\newcommand{\MyCite}[1]{\citet*{#1}. \citetalias{#1}.}
Used as \MyCite{Andrienko2003} and producing: Andrienko et al. (2003). GIS for Everyone: The CommonGIS Project and Beyond.

Why does LaTeX start a new line when making a reference

I just created a LaTeX document and compile it to a PDF using pdftex. Every time I make a reference using the \ref command, the reference is put on a new line. Why does this happen and how do I prevent this?
Are you by any chance using \\ in URLs instead of //? \\ is used as a linebreak in TeX.
Try to localize the problem: create a new file which initializes hyperref the same way, uses no other packages, and has some text and a reference. Check if references still start on new lines. If they do, you can show it here (and on LaTeX forums); if not, add more of your report's preamble until you get a file which exhibits the problem.
Can you prepare a minimum example demonstrating your problem?
I've tried with:
\documentclass{report}
\usepackage[pdftex,breaklinks=true,bookmarks=true,bookmarksopen= true,pdfpagemode=UseNone,plainpages=false,pdfpagelabels,pdfstartview=FitH,olorlinks=true,citecolor=blue]{hyperref}
\begin{document}
Test \url{http://test.com} \ref{http://someother.com}.
\end{document}
And the whole output is a single line in PDF.
BTW \ref is used to produce internal document links (like in "As described in chapter \ref{chapter:second}...").
It was my own fault, I used \par for the paragraph sign instead of \P. This is one of my first LaTeX documents, so I overlooked it. Thanks for the quick responses/answers though.

Resources