Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[[--opt]] typesets to -opt (drops one dash) with T1 font encoding #40

Open
dbosk opened this issue May 20, 2024 · 10 comments
Open

[[--opt]] typesets to -opt (drops one dash) with T1 font encoding #40

dbosk opened this issue May 20, 2024 · 10 comments

Comments

@dbosk
Copy link
Contributor

dbosk commented May 20, 2024

See -edit and --edit:
image

The code for the image:

The course responsible must then generate the sign-up sheet.
This is done by running the following command.
\begin{minted}{bash}
nytid signupsheets generate prg[im]24 --edit
\end{minted}
The [[--edit]] option opens the generated sign-up sheet (or sheets in our case, 

Not sure this is expected, I kind of expect [[...]] to be close to verbatim (exception being chunk names) considering I quote code with it.

@dbosk
Copy link
Contributor Author

dbosk commented May 20, 2024

I can add that it's the same in code chunks, not just quoted code.

<<script.sh>>=
cmd --arg
@

Here --arg would also be typeset as -arg.

@dbosk
Copy link
Contributor Author

dbosk commented May 20, 2024

>> (when not part of a chunk) is typeset as », but > is typeset as >. Not sure if that's intended. I would be fine with » if > would be more similar. (I'm writing shell scripts at the moment.)

@nrnrnr
Copy link
Owner

nrnrnr commented May 20, 2024

I can't duplicate the fault.

Please send a complete example plus the weave command you used.
t.nw.txt
t.pdf

@dbosk
Copy link
Contributor Author

dbosk commented May 21, 2024

Sorry for that, experimented a bit. Here is a MWE, test.nw:

\documentclass{article}
\usepackage[utf8]{inputenc}
%\usepackage[T1]{fontenc}
\usepackage{noweb}

\begin{document}
This is a test to see how [[--opt]] is typeset.
<<script.sh>>=
echo "Hello, world!" >> /tmp/hello.txt
echo --opt
@
\end{document}

Weaved using noweave -delay test.nw > test.tex && pdflatex test.tex.

Got it down to the fontenc package. Whenever the fontenc line is uncommented, the problem occurs.

image

image

I use \usepackage[T1]{fontenc} to get the Swedish letters å, ä, ö correct in PDFs (when selecting and copying them from the PDF they're actually the letters, without T1 you can't copy the text).

@dbosk
Copy link
Contributor Author

dbosk commented May 21, 2024

Added But how is >> now, and > >? before \end{document}:
image
image

@dbosk
Copy link
Contributor Author

dbosk commented May 21, 2024

But in maths \(a > b\) works?:
image

@dbosk
Copy link
Contributor Author

dbosk commented May 21, 2024

Did some more experiments.

Seems like I don't need \usepackage[T1]{fontenc} anymore for Swedish. So I can just remove that line and solve my problem. (See below.)

If I use xelatex instead, everything just works:

\documentclass{article}
\usepackage{noweb}

\begin{document}
This is a test to see how [[--opt]] is typeset.
<<script.sh>>=
echo "Hello, world!" >> /tmp/hello.txt
echo --opt
@

But how is >> now, and > >?
But in maths \(a > b\) works?

What about å, ä and ö?
\end{document}

Weave using noweave -delay test.nw > test.tex && xelatex test.tex produces
image

@dbosk dbosk changed the title [[--opt]] typesets to -opt (drops one dash) [[--opt]] typesets to -opt (drops one dash) with T1 font encoding May 21, 2024
@dbosk
Copy link
Contributor Author

dbosk commented May 21, 2024

Turns out I need the T1 font encoding for other things. (I used other fonts in my original document.)
image
image

XeLaTeX didn't help here. Gives the same horrible font as in the top example, just without the upside-down symbols. But still the guillemets for >>. Works with XeLaTeX after setting fonts correctly.

image

@dbosk
Copy link
Contributor Author

dbosk commented May 21, 2024

The only issue I encounter with XeLaTeX is that I can't use [[...]] in section headings. Might be due to the fonts. I'll continue experimenting.

@nrnrnr
Copy link
Owner

nrnrnr commented May 21, 2024

If you are using Unicode, XeLaTeX is definitely the way to go.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants