Take the 2-minute tour ×
TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

I have a problem getting the - and = characters between single quotations.

`-' and `=' both produces -' in the generated pdf. If I put an alphabetical character between ` and ' it works as expected. I guess - and = are special characters.

How do I treat them?

MWE:

\documentclass[12pt]{report}

\def\magyarOptions{defaults=hu-min}

\usepackage{t1enc} 

\usepackage{times} 

\usepackage{amsmath}
\usepackage{amssymb}
\usepackage{amsthm}
\usepackage{amsfonts}
\usepackage{latexsym}
\usepackage{fancyhdr} 
\usepackage{array}
\usepackage{graphicx}
\usepackage{listings}
\usepackage[usenames,dvipsnames]{color}
\usepackage[toc,page]{appendix}
\usepackage{float}
\usepackage{alltt}
\usepackage{anysize}
\usepackage{hyperref}
\usepackage[utf8]{inputenc}
\usepackage[magyar]{babel}
\usepackage[section]{placeins}
\usepackage{subcaption}
\usepackage{caption}
\usepackage{tikz}
\usepackage[shortlabels]{enumitem}
\usepackage{longtable}
\usepackage{mathtools}
\usepackage{setspace}
\usepackage{csquotes}

\begin{document}

Hello TeX! This is how I try to add single quotation marks before and after the characters `-' and `='.

\end{document}
share|improve this question
1  
Please note that t1enc and times are obsolete. Rather use \usepackage[T1]{fontenc} and, for Times, \usepackage{mathptmx} or `\usepackage{newtxtext,newtxmath}). –  egreg May 1 at 13:39
    
some "duplicate" packages here: amssymb loads amsfonts, so no need to have them both. also, mathtools loads amsmath. and the usual recommendation is that hyperref should be loaded last; for this, you should check specific package recommendations, because there are some exceptions. –  barbara beeton May 1 at 14:00

2 Answers 2

up vote 8 down vote accepted

The file magyar.ldf defines ` as a shorthand prefix; in particular, from what I have been able to understand from the code,

`--

gives an “intelligent en-dash”; when `- appears, it just produces a hyphen. Conversely, `= is a hyphen for composite words, allowing hyphenation in the word part following the hyphen.

If you want a single opening quote, just type `{}

\documentclass[12pt]{report}

\def\magyarOptions{defaults=hu-min}

\usepackage[T1]{fontenc}
\usepackage[utf8]{inputenc}
\usepackage[magyar]{babel}

\begin{document}

Hello TeX! This is how I try to add single quotation marks
before and after the characters `{}-' and `{}='.

Examples:

\verb|$a-b$|: $a-b$

\verb|$a`--b$|: $a`--b$

\verb|a-b|: a-b

\verb|a`-b|: a`-b

\verb|a`--b|: a`--b
\end{document}

Unfortunately, the language definition file is rather poorly documented. In the sense that I couldn't find any documentation for it.

enter image description here

share|improve this answer

Tried csquotes? It has commands like:

  1. \textquoteleft
  2. and \textquoteright

And an MWE:

\documentclass{article}

\usepackage[english=british]{csquotes}

\newcommand\singlequote[1]{\textquoteleft #1\textquoteright~}

\begin{document}

\noindent 
\singlequote{=} some text here. \\
\singlequote{-} more text here.

\end{document}
share|improve this answer
    
Thanks, works nicely. I have text right after the quotation, but no spaces were added after the \textquoteright command. I added ~ after it to force a space. –  VSZM May 1 at 12:48
1  
I've edited my post slightly so you can use a macro instead of typing it all out every single time. –  1010011010 May 1 at 12:56
4  
Having loaded csquotes this way you can just write \enquote*{=} etc. –  Andrew Swann May 1 at 13:18

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.