-
Notifications
You must be signed in to change notification settings - Fork 789
Tools: Simple Bikeshed to LaTeX search and replace #7994
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
base: main
Are you sure you want to change the base?
Conversation
mattkretz
commented
Jun 23, 2025
- bs_to_tex.sh does a first pass on the wording sources of a Bikeshed paper.
- add_libconcept.sh can be used as a second pass to index concept names.
* bs_to_tex.sh does a first pass on the wording sources of a Bikeshed paper. * add_libconcept.sh can be used as a second pass to index concept names.
This seems like a useful utility, but I don't see why it needs to live in this repository. As you may have noticed, it can take a little while until PRs here are reviewed, you're making things a bit inconvenient for yourself if you want to keep this script here, and update it here. Maybe we could mention such useful tools in the README, and you could host this somewhere where you can make changes easily yourself? |
I'm fine having this tool here. I just haven't had a chance to had a closer look. |
tools/bs_to_tex.sh
Outdated
@@ -0,0 +1,51 @@ | |||
#!/bin/zsh |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do we need to have zsh for this? Is this available on MacOS?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
zsh is probably the most common shell after bash. I have no experience with MacOS, but I read "most versions of macOS ship zsh by default".
I'm a zsh user, which is why I know its extensions (over plain sh). I'm sure it can be changed to use bash extensions instead or possibly even plain sh. Installing zsh is a simple command (if at all). Porting to bash might take a lot more time (though, I have no idea, because I never know what syntax is common between bash and zsh).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think everything used here behaves the same in bash, but I would need to double check the =~
behaviour (quoting the =~
operands always seems to work in ways that surprise me for bash).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
OK -- that's fine, but could we maybe have a comment at the top that calls out the need for zsh and its specific behaviour/difference from Posix/Bash, so that it's easy to remember this? I can otherwise imagine future frustration when someone trying to understand/debug this misses that detail.
And to check, the other script is fine with just "sh"?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please switch to bash; this is a trivially small script.
The one thing that strikes me as odd (not being a bash expert) in the following is "((itemize))". Please switch this to more basic [ or [[ syntax.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
((
is Bash, too, e.g. for ((a = 0; a != 10; ++a)); do echo ${a}; done
. That part is fine I think.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Indeed; I've never come across that.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sorry for that wrong comment I posted before.
So after changing to bash
the script runs without errors but with a different output. Now I'll need to start debugging where it goes wrong. That's exactly why I don't write bash
scripts.
edit: @jwakely got it right. I'll test with the other paper I had and if that also works then I'll update this PR accordingly.
|
||
usage() { | ||
cat <<EOF | ||
Usage: $0 <LaTeX source> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
could we use curly braces for all variable references, e.g. ${0}
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
${0}
specifically reads very strange to me and unconditional use of braces is inconsistent with the rest of our shell scripts. I very much prefer to only use braces when they serve a purpose.
tools/add_libconcept.sh
Outdated
@@ -0,0 +1,41 @@ | |||
#!/bin/sh |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This script needs bash; plain "sh" is not enough, because it uses x=$(blah)
syntax.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Oh. I was using dash
, hoping it is close enough to plain sh
. But it seems only backticks would be supported. Fine. bash
is everywhere we care about.
tools/bs_to_tex.sh
Outdated
@@ -0,0 +1,51 @@ | |||
#!/bin/zsh |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please switch to bash; this is a trivially small script.
The one thing that strikes me as odd (not being a bash expert) in the following is "((itemize))". Please switch this to more basic [ or [[ syntax.