2

I'm new to LaTeX and am currently using it to try and piece together a report on the orthography of the Armenian language. I'm trying to create a table where one column will display the printed letters and the other will display how they look in a "handwritten" font. In the second column, I'm interested in placing a baseline and a midline to show how the letters are to be written. The code I have looks something like this example (where I have replaced the actual fonts with Times New Roman):

\documentclass{article}

\usepackage{fontspec}
\setmainfont{Times New Roman}
\usepackage[normalem]{ulem}
\usepackage{color}

\newcommand\baseline{\bgroup\markoverwith{\textcolor{blue}{\rule[0ex]{2pt}{0.4pt}}}\ULon}
\newcommand\midline{\bgroup\markoverwith{\textcolor{red}{\rule[0.72ex]{2pt}{0.4pt}}}\ULon}
\newcommand\textline[1]{\huge{\baseline{\midline{\makebox[1cm][c]{#1}}}}}

\begin{document}
\begin{tabular}[c]{|c|c|c|c|}
\hline
A & \textline{A} & B & \textline{B}\\
\hline
C & \textline{C} & D & \textline{D}\\
\hline
\end{tabular}
\end{document}

I am using TeXstudio and XeLaTeX. The output seems fine, but what I'm wondering about is this error that keeps popping up, namely:

! Dimension too large.
\UL@on ...UL@height \advance \UL@height -\ULdepth 
                                              \setbox \UL@box \hbox {{#1...
l.15 A & \textline{A}
                  & B & \textline{B}\\
I can't work with sizes bigger than about 19 feet.
Continue and I'll use the largest value I can.

As I said, it seems to compile correctly, but I'm wondering what the cause of this error is and if there is any possible remedy to the situation. Thanks a bunch!

1

I would take a different approach and not try to do anything fancy with underlining.

\documentclass{article}
\usepackage{fontspec}
\setmainfont{Times New Roman}
\usepackage{xcolor}

\newcommand{\drebaserule}{\rlap{\color{blue}\rule{1cm}{0.4pt}}}
\newcommand{\dremidrule}{\rlap{\color{red}\rule[0.72ex]{1cm}{0.4pt}}}
\newcommand{\dredemo}[1]{\huge\drebaserule\dremidrule\makebox[1cm]{#1}}

\begin{document}
\begin{tabular}[c]{|c|c|c|c|}
\hline
A & \dredemo{A} & B & \dredemo{B}\\
\hline
C & \dredemo{C} & D & \dredemo{D}\\
\hline
\end{tabular}
\end{document}

I make boxes of zero width but with lines of the appropriate length.

If you'd like a dashed rule, then you can use the package dashrule as follows:

\documentclass{article}
\usepackage{fontspec}
\setmainfont{Times New Roman}
\usepackage{xcolor}
\usepackage{dashrule}

\newlength{\dresampletextwd}
\setlength{\dresampletextwd}{1cm}
\newcommand{\dremidrule}{\rlap{\color{red}\hdashrule[0.72ex][x]{\dimexpr\dresampletextwd+2pt}{0.4pt}{3pt 2pt}}}
\newcommand{\drebaserule}{\rlap{\color{blue}\hdashrule[0pt][c]{\dresampletextwd}{0.4pt}{}}}
\newcommand{\dredemo}[1]{\huge\drebaserule\dremidrule\makebox[\dresampletextwd]{#1}}

\begin{document}
\begin{tabular}[c]{|c|c|c|c|}
\hline
A & \dredemo{A} & B & \dredemo{B}\\
\hline
C & \dredemo{C} & D & \dredemo{D}\\
\hline
\end{tabular}
\end{document}

enter image description here

Here I've add a length to more easily go in and change the width of the boxes containing the sample text.

  • Thanks a lot for the great answer! Both of them work like a charm. One small question though. If I combine the two methods, using method #1 (with the substitution of \dresampletextwd for 1 cm) for \drebaserule and method #2 to get the dashed line for \dremidrule, it still compiles correctly. Is there any potential disadvantage to doing this instead of using the \hdashrule command in both instances? – Dre Aug 3 '13 at 20:28
  • @Dre Shouldn't be a problem and probably makes more sense if you're not intending to use a dashed line for the one. – A.Ellett Aug 3 '13 at 20:30

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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