2

I use this code:

\documentclass[12pt,a4paper]{article}
\usepackage[dutch]{babel}
\usepackage[utf8]{inputenc}
\usepackage[T1]{fontenc}
\usepackage{lmodern}

\begin{document}
\begin{verbatim*}
CREATE TABLE teams (

    nr INT(10) NOT NULL AUTO_INCREMENT,

    tName VARCHAR(30) NOT NULL,

    tDescription VARCHAR(250) NOT NULL

);

CREATE TABLE users (

    nr INT(10) NOT NULL AUTO_INCREMENT,

    uName VARCHAR(250) NOT NULL,

    uTeam VARCHAR(250) NOT NULL,

    uFunction VARCHAR(250) NOT NULL,

    uEmail VARCHAR(250) NOT NULL

);
\end{verbatim*}
\end{document}

My question now is: how can I also show the blank lines?

I get this output:

CREATE TABLE teams (     nr INT(10) NOT NULL AUTO_INCREMENT,     tName VARCHAR(30) NOT NULL,     tDescription
VARCHAR(250) NOT NULL ); CREATE TABLE users (     nr INT(10) NOT NULL AUTO_INCREMENT,     uName VARCHAR(250)
NOT NULL,     uTeam VARCHAR(250) NOT NULL,     uFunction VARCHAR(250) NOT NULL,     uEmail VARCHAR(250)
NOT NULL );

There's, of course, more code and text, like the graphicx and hyperref packages, pictures included, tables, etc. but I think you don't need them... I think they don't look to each other, do they? I'll hear it if I have to change the / add code.

  • (code marking on this site is indent by four spaces or use the {} button, not ''') – David Carlisle Jul 10 '17 at 8:52
  • The code you have posted works for me, with blank lines showing and spaces marked as visible space: This output – David Carlisle Jul 10 '17 at 8:55
  • @DavidCarlisle Thank you for the tip about the code here. There are so much options, I am sorry! About the output: I cannot see picturer :( (I am blind)... Could you send the output pdf or not? – Jordy Deweer Jul 10 '17 at 8:59
  • Oh I am very sorry for posting an image in that way. when you say you lose the lines in the verbatim do you refer to the visible pdf or the text extracted or read by a screen reader. (I did not check that) I could send you the pdf I generated if you email me. (you could email the pdf that you got) you can google my name to find my gmail addresss – David Carlisle Jul 10 '17 at 9:04
  • @DavidCarlisle I think that I just sent you an email. If not, please say it... I used the second hit after entering your full name. – Jordy Deweer Jul 10 '17 at 9:35
1

[partial cw answer, if anyone with more knowledge of screen reader interaction with PDF wants to extend or post a real answer, please do]

As confirmed via some off site email, the output in Jordy's original document is like the output generated by the example posted and looks OK in a visual rendering.

The issue is that all lines in verbatim are being dropped by the screen reader so it is all on one line with no indication at all for the blank lines.

You would get a similar effect if reading the output of pdftotext on the pdf generated by the above. the pdftotext output is

CREATE␣TABLE␣teams␣(
␣␣␣␣nr␣INT(10)␣NOT␣NULL␣AUTO_INCREMENT,
␣␣␣␣tName␣VARCHAR(30)␣NOT␣NULL,
␣␣␣␣tDescription␣VARCHAR(250)␣NOT␣NULL
);
CREATE␣TABLE␣users␣(
␣␣␣␣nr␣INT(10)␣NOT␣NULL␣AUTO_INCREMENT,
␣␣␣␣uName␣VARCHAR(250)␣NOT␣NULL,
␣␣␣␣uTeam␣VARCHAR(250)␣NOT␣NULL,
␣␣␣␣uFunction␣VARCHAR(250)␣NOT␣NULL,
␣␣␣␣uEmail␣VARCHAR(250)␣NOT␣NULL
);

1

so no marker that line breaks are supposed to be read "verbatim" here and no indication at all of the blank lines.

One simple way to make the newlines visible (and hopefully read correctly) would be

\documentclass[12pt,a4paper]{article}
\usepackage[dutch]{babel}
\usepackage[utf8]{inputenc}
\usepackage[T1]{fontenc}
\usepackage{lmodern}

\begin{document}
{\def\null{\hbox{\rlap{<NEWLINE>}}}
\begin{verbatim*}
CREATE TABLE teams (

    nr INT(10) NOT NULL AUTO_INCREMENT,

    tName VARCHAR(30) NOT NULL,

    tDescription VARCHAR(250) NOT NULL

);

CREATE TABLE users (

    nr INT(10) NOT NULL AUTO_INCREMENT,

    uName VARCHAR(250) NOT NULL,

    uTeam VARCHAR(250) NOT NULL,

    uFunction VARCHAR(250) NOT NULL,

    uEmail VARCHAR(250) NOT NULL

);
\end{verbatim*}
}
\end{document}

But that produces a visible <NEWLINE> at the end of every line (I suppose you could use \textcolor to make that white).

with pdftotext as an approximation to a screen reader you then get

CREATE␣TABLE␣teams␣(<NEWLINE>
<NEWLINE>
␣␣␣␣nr␣INT(10)␣NOT␣NULL␣AUTO_INCREMENT,<NEWLINE>
<NEWLINE>
␣␣␣␣tName␣VARCHAR(30)␣NOT␣NULL,<NEWLINE>
<NEWLINE>
......
  • Can't test now, but I would try to insert \par at the end of lines. Copy & paste in pdf readers normally don't loose them. – Ulrike Fischer Jul 10 '17 at 11:49
  • @UlrikeFischer \leavevmode\null\par is what obeylines as used by verbatim inserts currently (which is why I just made \null visible), but here with no parskip or indentation the par isn't (apparently) being seen by the screen reader as anything other than an in-paragraph linebreak – David Carlisle Jul 10 '17 at 12:05
  • @DavidCarlisle For now, this is the best answer. Let's hope someone else knows another, better answer... Thank you very much! – Jordy Deweer Jul 11 '17 at 15:08

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.