ngscopeclient / scopehal-docs

End user documentation for libscopehal
BSD 3-Clause "New" or "Revised" License
7 stars 38 forks source link

Adjusted code block spacing for improved copy-paste #67

Closed hansemro closed 1 year ago

hansemro commented 1 year ago

Fixes https://github.com/glscopeclient/scopehal-docs/issues/44

Reference: https://tex.stackexchange.com/a/300132

hansemro commented 1 year ago

Text will be spaced less apart to reduce unwanted space insertion. Maybe this is less readable, but at least this is more reliably copied.

hansemro commented 1 year ago

Before:

image

sudo apt install build - essential cmake pkg - config libglm - dev \
libgtkmm -3.0 - dev libsigc ++ -2.0 - dev libyaml - cpp - dev \
liblxi - dev texlive texlive - fonts - extra libglew - dev \
catch2 libvulkan - dev glslang - dev libglfw3 - dev

After:

image

sudo apt install build-essential cmake pkg-config libglm-dev \
libgtkmm-3.0-dev libsigc++-2.0-dev libyaml-cpp-dev \
liblxi-dev texlive texlive-fonts-extra libglew-dev \
catch2 libvulkan-dev glslang-dev libglfw3-dev
hansemro commented 1 year ago

The current fix does not eliminate inserted newlines on lengthy text:

image

wget https://sdk.lunarg.com/sdk/download/1.3.224.1/linux/vulkansdk-linux-x86_64
-1.3.224.1.tar.gz
...
sudo cp $VULKAN_SDK/etc/vulkan/explicit_layer.d/VkLayer_*.json /usr/local/share/
vulkan/explicit_layer.d
hansemro commented 1 year ago

Setting \lstset{breakatwhitespace=true} would prevent long text from splitting, but certain text may not fit entirely in its code block and does not insert \ for line continuation.

image

hansemro commented 1 year ago

Specified \lstset{prebreak=\textbackslash} to insert multiline breaks (\) for multiline commands. This will also split long URLs as shown for the wget command without manually inserting multiline breaks.

image

However, we cannot rely on listings package to always insert breaks in sensible locations (sometimes in the middle of an argument), so I had to manually insert some.

hansemro commented 1 year ago

This should be ready for review.