Fine tuning diacritical marks in fonts
Complex solution
This solution skips loading fontenc
and uses the package newunicodechar
to redefine the accented characters, in order to preserve the original accents while retaining some hyphenation. The trick used is to split the word while shortening the interword space to nothing.
As I said, some (but not all) hyphenation is preserved, as well as ligatures. Copying from the pdf should work like just not using fontenc
(and for me (Evince on Ubuntu) that works just fine). Kerning does not work for the accented letters. Also, the code fails under various circumstances (e.g. in section titles and captions), though in those cases you can use the old command like \"O
etc.
\documentclass{article}
\usepackage[utf8]{inputenc}
\usepackage{newunicodechar}
\newcommand{\DeclareAccentChar}[2]{%
\newunicodechar{#1}{%
\bgroup
\newdimen\originalspacelength%
\newdimen\originalspacestretch%
\newdimen\originalspaceshrink%
\originalspacelength=\fontdimen2\font%
\originalspacestretch=\fontdimen3\font%
\originalspaceshrink=\fontdimen4\font%
\fontdimen2\font=0pt%
\fontdimen3\font=0pt%
\fontdimen4\font=0pt%
#2%
\nolinebreak\space
\fontdimen2\font=\originalspacelength
\fontdimen3\font=\originalspacestretch
\fontdimen4\font=\originalspaceshrink
\egroup}}
\DeclareAccentChar{Á}{\'A}
\DeclareAccentChar{Å}{\AA}
\DeclareAccentChar{É}{\'E}
\DeclareAccentChar{Í}{\'I}
\DeclareAccentChar{Ó}{\'O}
\DeclareAccentChar{Ö}{\"O}
\DeclareAccentChar{Ő}{\H{O}}
\DeclareAccentChar{Ú}{\'U}
\DeclareAccentChar{Ü}{\"U}
\DeclareAccentChar{Ű}{\H{U}}
\DeclareAccentChar{ö}{\"o}
\DeclareAccentChar{é}{\'e}
\begin{document}
AÁÅEÉIÍOÓÖŐUÚÜŰ
\parbox{0pt}{\null\ cooperation}
\hspace{3em}
\parbox{0pt}{\null\ coöperation}
\hspace{4em}
\parbox{0pt}{\null\ co\-öp\-er\-a\-tion}
\bigskip
\parbox{3em}{VAV VÅV}
soufflé
\end{document}
Since the accented characters are defined as regular LaTeX expressions, it might be possible to edit the code to improve copying from the pdf. Also, it might be possible to get more hyphenation points by locally relaxing TeX's hyphenation limits.
If you prefer the accents of Steven B. Segletes' answer, just add the following code from that answer together with definitions for the lowercase characters (note that lowercase i needs to be defined as \DeclareAccentChar{í}{\'\i}
) to get the same output as his (except that Å is taken from Computer Modern instead of Latin Modern) while retaining some hyphenation.
\usepackage{stackengine,scalerel,graphicx}
\renewcommand\'[1]{\stackengine{.15ex}{#1}{%
\scalebox{1.2}[.75]{\scaleto{\scriptscriptstyle\prime}{.6ex}}}{O}{c}{F}{T}{S}}
\renewcommand\H[1]{\stackengine{.15ex}{#1}{%
\scalebox{1.2}[.75]{\scaleto{\scriptscriptstyle\prime\kern-.03em\prime}{.6ex}}}{O}{c}{F}{T}{S}}
\renewcommand\"[1]{\stackengine{.2ex}{#1}{%
.\kern-.1em.}{O}{c}{F}{T}{S}}
Correct kerning
This code adds an optional argument to get correct kerning, but it really messes with copying text. It will fail if the width of the accented character doesn't match the width of the unaccented character. Also, when viewing the pdf the character may seem thicker than usual, though it should print fine (I hope).
\documentclass{article}
\usepackage[utf8]{inputenc}
\usepackage{newunicodechar}
\newlength\charwidth%
\newcommand{\DeclareAccentChar}[3][]{%
\newunicodechar{#2}{%
#1%
\settowidth{\charwidth}{#1}%
\kern-\charwidth
\newdimen\originalspacelength
\newdimen\originalspacestretch
\newdimen\originalspaceshrink
\originalspacelength=\fontdimen2\font
\originalspacestretch=\fontdimen3\font
\originalspaceshrink=\fontdimen4\font
\fontdimen2\font=0pt%
\fontdimen3\font=0pt%
\fontdimen4\font=0pt%
#3%
\kern-\charwidth%
\nolinebreak\space
\fontdimen2\font=\originalspacelength
\fontdimen3\font=\originalspacestretch
\fontdimen4\font=\originalspaceshrink
#1}}
\DeclareAccentChar{Á}{\'A}
\DeclareAccentChar[A]{Å}{\AA}
\begin{document}
\parbox{3em}{VAV VÁV}
\parbox{3em}{VAV VÅV}
\end{document}
Simpler solution
You can \usepackage{lmodern}
to get a version somewhat in between. In particular, the ring on Å is a circle (though somewhat thicker than the original). The accents are less slanted as well, especially for Ő and Ű.
With this method kerning, hyphenation and copying all works fine. Unless you really want the original accents or prefer cm-super, this is the way to go.
\documentclass[12pt]{article}
\usepackage[utf8]{inputenc}
\usepackage[T1]{fontenc}
\usepackage{lmodern}
\begin{document}
A\'A\AA E\'EI\'IO\'O\"O\H{O}U\'U\"U\H{U}
\end{document}
Further reading: Latin Modern vs cm-super?
One can use lmodern
, but redefine the functions \'
, \H
, and \"
, though that may have some danger associated with it. As wipet points out, this approach breaks hyphenation(*), which in itself is enough to recommend against its use.
(*) Based on recent conversation with egreg at Words before rules are not divided, adding \nobreak\hspace{0pt}
to the end of my stackengine
diacritic redefinitions will allow fragment hyphenation in the text that follows the diacritic. Of course, manual hyphenation can always be added.
\documentclass[12pt]{article}
\usepackage[T1]{fontenc}
\usepackage{lmodern,stackengine,scalerel,graphicx}
\renewcommand\'[1]{\stackengine{.15ex}{#1}{%
\scalebox{1}[.75]{\scaleto{\scriptscriptstyle\prime}{.6ex}}}{O}{c}{F}{F}{S}%
\nobreak\hspace{0pt}}
\renewcommand\H[1]{\stackengine{.15ex}{#1}{%
\scalebox{1}[.75]{\scaleto{\scriptscriptstyle\prime\prime}{.6ex}}}{O}{c}{F}{F}{S}%
\nobreak\hspace{0pt}}
\renewcommand\"[1]{\stackengine{.2ex}{#1}{%
.\kern-.1em.}{O}{c}{F}{F}{S}\nobreak\hspace{0pt}}
\begin{document}
A\'A\AA E\'EI\'IO\'O\"O\H{O}U\'U\"U\H{U}
a\'a\aa e\'ei\'{\char"019}o\'o\"o\H{o}u\'u\"u\H{u}
\smallskip\tiny
A\'A\AA E\'EI\'IO\'O\"O\H{O}U\'U\"U\H{U}
\parbox{0pt}{\null\ cooperation}
\parbox{0pt}{\null\ co\"operation}
\parbox{0pt}{\null\ co\-\"op\-er\-a\-tion}
\end{document}
At the OP's request, I make the primes thicker horizontally (by stretching them 20% horizontally)...but of course that comes at the price of making them slightly more slanted. I have also reduced the distance slightly between the double accents of \H
.
\documentclass[12pt]{article}
\usepackage[T1]{fontenc}
\usepackage{lmodern}
\usepackage{stackengine,scalerel,graphicx}
\renewcommand\'[1]{\stackengine{.15ex}{#1}{%
\scalebox{1.2}[.75]{\scaleto{\scriptscriptstyle\prime}{.6ex}}}{O}{c}{F}{T}{S}%
\nobreak\hspace{0pt}}
\renewcommand\H[1]{\stackengine{.15ex}{#1}{%
\scalebox{1.2}[.75]{\scaleto{\scriptscriptstyle\prime\kern-.03em\prime}{.6ex}}}{O}{c}{F}{T}{S}%
\nobreak\hspace{0pt}}
\renewcommand\"[1]{\stackengine{.2ex}{#1}{%
.\kern-.1em.}{O}{c}{F}{T}{S}\nobreak\hspace{0pt}}
\begin{document}
A\'A\AA E\'EI\'IO\'O\"O\H{O}U\'U\"U\H{U}
a\'a\aa e\'ei\'{\char"019}o\'o\"o\H{o}u\'u\"u\H{u}
\smallskip\tiny
A\'A\AA E\'EI\'IO\'O\"O\H{O}U\'U\"U\H{U}
\end{document}