SHARE
TWEET

Untitled

a guest Jun 15th, 2019 65 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. documentclass{article}
  2. usepackage{color}
  3. usepackage{listings}
  4.  
  5. lstdefinelanguage{new}{
  6.     moredelim=*[s][color{red}]{(}{)},
  7.     moredelim=*[s][color{green}]{[}{]},
  8.   }
  9. lstset{
  10.   language=new
  11.   %,breaklines=true
  12.   }
  13.  
  14. begin{document}
  15.  
  16. begin{figure}
  17. begin{lstlisting}
  18. outside(in paren) [in brackets (paren+brackets) brackets again] outside again
  19. end{lstlisting}
  20. end{figure}
  21.  
  22. end{document}
  23.      
  24. lst@Def{`)}{lst@breakProcessOther)}
  25.      
  26. lst@Def=macro:
  27. #1->lccode `~=#1lowercase {def ~}.
  28.      
  29. documentclass{article}
  30.  
  31. usepackage{color}
  32.  
  33. usepackage{listings}
  34.  
  35. lstdefinelanguage{new}{
  36.   moredelim=*[s][color{red}]{(}{)},
  37.   moredelim=*[s][color{green}]{[}{]},
  38. }
  39.  
  40. lstset{
  41.   language=new,
  42.   breaklines=true
  43. }
  44.  
  45. usepackage{etoolbox}
  46.  
  47. makeatletter
  48.  
  49. patchcmd{lsthk@SelectCharTable}{%
  50.   lst@ifbreaklineslst@Def{`)}{lst@breakProcessOther)}fi
  51. }{%
  52. }{
  53. }{
  54. }
  55.  
  56. makeatother
  57.  
  58. begin{document}
  59.  
  60. begin{lstlisting}
  61. outside (in paren) [in brackets (paren+brackets) brackets again] outside again
  62. end{lstlisting}
  63.  
  64. end{document}
  65.      
  66. begin{lstlisting[literate={(}{{textbf{(}}}1                          
  67.                            {]}{{textbf{)}}}1]
  68. (In text I'm closing using]
  69. end{lstlisting}
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
Not a member of Pastebin yet?
Sign Up, it unlocks many cool features!
 
Top