Quantcast
Channel: Active questions tagged copy-paste - TeX - LaTeX Stack Exchange
Viewing all articles
Browse latest Browse all 70

Whitespace rendering + selectable indentation spaces for python/yaml/etc code snippets

$
0
0

I have three related issues here and I wonder, which approaches/libraries/built-in utilities may help me achieve the following:

First

There are many programming languages and file formats which depend on proper indentation, Python and Yaml being the most prominent examples. I would like to embed copy-pasteable leading spaces.

I've checked the following questions to see if I can render copypaste-able spaces:

\documentclass{article}\usepackage{transparent}\begin{document}\showoutput\makeatletter\def\@xobeysp{\leavevmode\nobreak\texttransparent{0}{\char32}}\makeatother\begin{verbatim}for row in range(1,9):    for col in range(1,9):        print(int(str(row)+str(col)))\end{verbatim}\end{document}

produces

for␣row␣in␣range(1,9):␣␣␣␣for␣col␣in␣range(1,9):␣␣␣␣␣␣␣␣print(int(str(row)+str(col)))

on copy-paste

Second

I would like to render whitespace (spaces) in a form of a small opaque dots. An example of what I am trying to do could be easily explained visually, see Prism.js Plugin called "Show Invisibles"

Third

I would like to provide the possibility to select the whitespace redndered with the dot but instead of dot a person gets proper whitespace in the buffer.

Most programming books do not allow user to copy-paste the contents of a code snippet with the whitespace preserved. It is rather painful to then reindent the paste. Is there a possibility to embed selectable whitespace under the dots, so when a person selects and copies the dots, the actual copy contains not the dots but the spaces?

Thanks in advance!


Viewing all articles
Browse latest Browse all 70

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>