LaTeX help with href - latex

I am trying to create a hyperlink using LaTeX. When I use the command pdflatex to compile the file, I get an error.
The relevant lines of the document are:
\documentclass[12pt]{article}
\usepackage{hyperref}
\begin{document}
...
\href{http://www.cs.utah.edu/dept/old/texinfo/as/gprof_toc.html}{gprof}
pdflatex created a file called missfont.log, which contains this:
mktextfm pzdr
What am I doing wrong?

Do you have the pzdr font installed? If you're on Debian or Ubuntu, try installing the texlive-fonts-recommended package.

Does the hyperref package purport to make hyperlinks to arbitrary web pages? I thought it was just for intra-document links (which it does automatically). I would do
\usepackage{url}
and
\url{http://foo.com}
to format a URL in your document.
ADDED: Thanks Will, I didn't know that about href. But if you're creating a document that's mainly targeting paper as the intended medium, I think the url package for formatting URLs is the way to go. But if you think the href package subsumes the url package, I'd love to be set straight on that.

Related

Wrap URL (ignores margin) in BibTeX using pdfLaTeX

I'm using the breakurl package and the hyperref package with pdfLatex and BibTeX to cite a url. The url is breaking, but not according to my margins. Is there any way I can make the url recognize my margins or force a line break? Thanks in advance.
Code:
\usepackage{hyperref}
\usepackage[vertfit]{breakurl}
#MISC{cmm:dataset,
author = {University of Bristol Centre for Multilevel Modelling},
title = {Datasets used in reviews},
howpublished = {\url{http://www.cmm.bristol.ac.uk/learning-training/multilevel-m-software/exam.shtml}},
}
Sometimes, when LaTeX cannot break lines nicely, it leaves them unadjusted. You can control that behavior putting \sloppy at the beginnig of your document and see if the behavior suits you more. Also, you have spaces in your URL, as I've seen in your post. Remove them. The url package usuallly does a nice job breaking urls (I have not used the breakurl package and my URLs break nicely by the slashes or dashes).
Better to add 'breaklinks' to the options for hyperref or if using url explicitly format the url in the bibtex file "\url{http:....}". This fixed the problem for me. You may still need to redefine the format for the url if the default box does not suit your purposes.

LaTeX: Cite, but don't reference

I'm producing a set of documents in LaTeX, and I would like to provide a single, global bibliography page for the whole set. This is because each document is page-limited: I don't want to take up space with references at the bottom of each one.
This means in each case, I would like to cite in the text, but not produce a reference at the end. I am using bibtex/natbib to handle the referencing.
Simplest example:
\documentclass[]{article}
\bibliographystyle{/usr/share/texmf/bibtex/bst/natbib/plainnat.bst}
\usepackage{natbib}
\begin{document}
In \citet*{MEF2010} I described the method.
\bibliography{bibliography.bib}
\end{document}
How can I do this? Essentially I just want it to cite correctly:
In Bloggs, Blagg and Blog (2010) I described the method.
But not add a references section at the end. Any ideas?
Thanks,
David
Instead of using \bibliography{bibliography.bib} you can try \nobibliography{bibliography.bib}.
You still need to enter the path so it can make the cross-references.
It happens due to missing packages. If you want to resolve the problem then enable the automatic installation packet. After that,First, you run the BibTeX file and generate the Pdf file (instead of pdfLatex file) and then pdfLatex to Pdf

How do I use TrueType fonts with LaTeX

I need to use a font family in my LaTeX documents, that is available as 18 .TTF (TrueTypeFont) files.
Where do I have to copy the files in my MiKTeX 2.8 installation?
How Do I make the fonts available for LaTeX?
I usually use pdfLaTeX. I read in Truetype-Fonts in LaTeX that TTF fonts are available without creating all the .TFM files. What is necessary for this case?
Can I install the fonts in the local-texfm directory? I would like to isolate the system installation and my manually added stuff. Probably it would be easier to copy this font family on another installation.
The easiest way would be to use XeLaTeX, for which you would just install the fonts to your system. A basic template would look like this (from https://web.archive.org/web/20111115151939/http://theotex.blogspot.com/2008/04/what-is-xetex-basic-template_15.html) :
%!TEX TS-program = xelatex
%!TEX encoding = UTF-8 Unicode
\documentclass[10pt]{memoir}
\usepackage{xltxtra,fontspec,xunicode}
\defaultfontfeatures{Scale=MatchLowercase}
\setromanfont[Numbers=Uppercase]{Hoefler Text}
\setmonofont[Scale=0.90,Ligatures=NoCommon]{Courier}
\title{Your Title}
\author{Your Name}
\date{}
\begin{document}
\maketitle
\chapter{Title}
\section{Section Title}
Your text
\subsection{Subsection Title}
Your Text
\end{document}
If you want to stick to LaTeX, you can generally try these steps:
Create the TeX font metrics (tfm), the font description (fd) and the font mapping (map).
Using ttf2tfm to generate .vpl, then vptovf to create .tfm.
Put the files (ttf, tfm, fd, map) into the proper directories in the local texmf tree.
Update the TeX filename database.
Using texhash
Register the mapping.
Using updmap-sys
It seems rather straightforward, but there are many traps regarding the font description and mapping, as well as the naming scheme for the output files.
There are a lot of scripts and howtos which didn't work for me. So I wrote this tool to help me use ttf fonts with LaTeX: http://devnotcorp.wordpress.com/2011/06/10/use-truetype-font-with-pdflatex/.
Although it's many years later I thought of adding that if one uses LuaLaTeX, you don't need to do anything apart from using the LuaLaTex package fontspec and then in the preamble of in the document \setmainfont{ComicSansMS}.
Use ttf2tfm and ttf2pk programs
try the following: http://www.radamir.com/tex/ttf-tex.htm. I tried it several YEARS ago; i found some bugs but I can't remember them anymore. I think it had something to do with wrong files being used with another program. The author had SWITCHED file extensions due to confusion because of the number of files being generated. I notified the author about it but I don't know if he had corrected it.

linebreak in url with Bibtex and hyperref package

Why is this item not shown properly in my bibliography?
#misc{ann,
abstract = {ANN is an implbmentation of nearest neighbor search.},
author = {David M. Mount and Sunil Arya},
howpublished = {\url{http://www.cs.umd.edu/~mount/ANN/}},
keywords = {knn},
posted-at = {2010-04-08 00:05:04},
priority = {2},
title = {ANN.},
url = "http://www.cs.umd.edu/~mount/ANN/",
year = {2008}
}
#misc{Nilsson96introductionto,
author = {Nilsson, Nils J.},
citeulike-article-id = {6995464},
howpublished = {\url{http://robotics.stanford.edu/people/nilsson/mlbook.html}},
keywords = {*file-import-10-04-11},
posted-at = {2010-04-11 06:52:28},
priority = {2},
title = {Introduction to Machine Learning: An Early Draft of a Proposed Textbook.},
year = {1996}
}
EDIT:
I am using
\usepackage{hyperref}
not
\usepackage{url}
. It produces error when using url package together with it. So can the two not work together?
I would like to use hyper links inside pdf file, so I want to use hyperref package instead of url package. I googled a bit, and try
\usepackage[hyperindex,breaklinks]{hyperref}
but there is still no line break just as before. How can I do it?
EDIT:
When using url and hyperref together,
if it is just
\usepackage{hyperref}
\usepackage{url}
the compilation by latex is fine, but the link is still hyperlink and has still no linebreak. If I do not use hyperref package, the link has linebreak, but I lose hyper links. Since \url can be used in both hyperref and url packages, how can I specify which package's \url is being used?
If it is
\usepackage{hyperref}
\usepackage[hyphens]{url}
the compilation by latex command will report clash with url:
! LaTex Error: Option clash for package url.
So I wonder how I should do?
You should use them in this order:
\usepackage[hyphens]{url}
\usepackage{hyperref}
You get this error when you use them the other way around.
! LaTex Error: Option clash for package url.
since the hyperref package loads the url package somewhere internally without that hypens option, and then you want to load it with the option, so it clashes.
Turning the order around does what you want and does not give this error (since the package is already loaded hyperref won't load it again with different options)
edit: this was with pdftex, I did not test with other tools.
edit2:
or as mentioned by PatrickT in a comment: \PassOptionsToPackage{hyphens}{url} if you're using a class that already loads the package, e.g. beamer.
I just ran across almost the same problem and found it solved by putting
\PassOptionsToPackage{hyphens}{url}
before the
\usepackage[...]{hyperref}
If you mean the too-wide spacing, that's because the URLs seems to not allow line-breaks. Why this happens is another question, and the answer depends on your preamble (the packages you use etc.). In principle, if properly used, the url package should allow line breaks.
EDIT
This problem (and its solution) is described here (sending you to a Google cache since the site is offline at the moment). Bottom line: either use the breakurl package, or PDFLaTeX, or both.
Weird, I load the url package (with no option) and hyphenation is done at the slashes / if needed.
Anyway, simple workaround:
howpublished = {\url{http://www.cs.umd.edu/}\url{~mount/ANN/}},
Manual job, but it splits up the URL yes or yes.
for me only this worked:
\usepackage[hyphens]{url}
\usepackage{hyperref}
...
\usepackage{biblatex}
\setcounter{biburlnumpenalty}{100}
\setcounter{biburlucpenalty}{100}
\setcounter{biburllcpenalty}{100}
Taken from: https://tex.stackexchange.com/questions/22854/url-line-breaks-with-biblatex
Normally URLs are hyphenated, but in your bibliography they seem not to be. When the URLs don't fit on one line, they are moved to the next line, and the text before them is stretched to fill out the preceding lines. Since there is only one place to break the line, it's not very likely that the preceding text will fit nicely into a whole number of lines, and so you get all the extra space.
EDIT: When you changed your bib entry, you happened to change it in such a way that the text did fit nicely. This is just a coincidence, you didn't fix your problem.
I suspect that putting
\usepackage{url}
in your preamble will solve it.
If url package doesn't help, try:
\usepackage{xurl}
\usepackage{hyperref}
Package xurl is an expanded version of url, which allows line breaking at every point in the url. Call xurl before hyperref.
Source: Does the hyperref breaklinks option have any effect?
I add this package:
\usepackage[hyphens]{url}
and in the bibtex I used:
howpublished = {**\url{**http://www.......**}**}
and it works out.
This simple solution worked for me:
\usepackage{hyperref}
\usepackage{breakurl}
The URLs are now perfect.
At the preamble, just put \usepackage{breaker} somewhere after \usepackage{hyper ref}. The \burl command is defined and, by default, the package also turns the \url command into a synonym of \burl.

LaTeX: disable or turn off hyperlinking for table of contents?

I want a table of contents, but I don't want each line to be a clickable hyperlink. How do I do this?
Details:
I am using the \anothertoc command from the shorttoc package to "import" the TOC from another document. Works fine, except that all the links for the imported TOC are broken (obviously)... so, I want to de-linkify them.
Not sure whether this is relevant, but the TOC that I'm importing is from a document that uses the hyperref package. I have a feeling that hyperref is making the TOCs hyperlinked, but I can't find any option for the hyperref package to disable hyperlinking for TOCs.
You can consider the linktoc parameter when importing the package with for instance
\usepackage[linktoc=none]{hyperref} or
\usepackage[linktoc=page]{hyperref}.
You can refer to paragraph 5.13 of the manual at https://mirrors.chevalier.io/CTAN/macros/latex/contrib/hyperref/doc/hyperref-doc.pdf
How are you "importing" the toc?
I'd have a look at the hyperref manual at : http://www.tug.org/applications/hyperref/manual.html
The simple solution would be to turn off hyperlinking in the document toc that you are importing, though I realize that might not be possible.
A solution using Normadize's answer based on \NoHyper working well with the shorttoc package:
{\protect\NoHyper%
\anothertoc{other-document}{Toc from other document}{1}
\protect\endNoHyper}%

Resources