I have a problem when using Fsi in VSCode. I've been having this issue since 1.7 and it persists in the current releases of 1.8.
If I use alt + enter to send a code selection to VSCode it works, but only for short selections. When the selection is too long it doesn't do anything in the Fsi window.
I found the same problem when using Terminal as well as Fsi and pasting a portion of text.
I couldn't find a character or line limit. I have e.g. tried pasting 1415 characters on 38 lines and it works. 1416 on 38 lines doesn't work for one of my files. But when I paste 1568 characters of "a" it works, 1569 doesn't. So it's not necessarily a character limit. When I put in some line breaks this works:
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
Add another a at the end and it doesn't (1534 characters, 35 lines).
It's really annoying, the only workaround I found is copying small parts of code into the Fsi individually and then executing them with ;;.
I'm on Windows 7, VSCode 1.8.1, ionide-fsharp 2.21.0, F# 4.0. Newlines count as 2 characters (\r\n).
Writing down these numbers, apparently with only a and newline we need characters + newlines < 1569. It doesn't hold for arbitrary other characters though.
It is indeed not a bug in the Ionide plugin, but in the layers below. I found a workaround which is now available in ionide-vscode-fsharp 2.23.1.
https://github.com/ionide/ionide-vscode-fsharp/issues/199
Related
Im getting a warning, as in tittle. Because of that (I think so) I cant see specified bacground colors and so on. Below I paste the source code.
The error tells that it do not recognize the "true - how can I fix that?
\documentclass[final,3p,times]{elsarticle}
\pgfplotsset{compat=1.18}
\begin{document}
\textbf{Appendix: moving mesh}
\lstinputlisting[language=python, captionpos=t, label={ListingRecHEL1}]{data/code.py}
\definecolor{codegreen}{rgb}{0,0.6,0}
\definecolor{codegray}{rgb}{0.5,0.5,0.5}
\definecolor{codepurple}{rgb}{0.58,0,0.82}
\definecolor{backcolour}{rgb}{0.6,0.9,0.1}
\renewcommand{\lstlistingname}{Kod}% Listing -> Algorithm
\lstdefinestyle{mystyle}{
backgroundcolor=\color{backcolour},
commentstyle=\color{codegreen},
keywordstyle=\color{codepurple},
numberstyle=\tiny\color{codegray},
stringstyle=\color{orange},
basicstyle=\ttfamily\tiny,
breakatwhitespace=false,
breaklines=true,
captionpos=b,
keepspaces=true,
numbers=true,
numbers=left,
numbersep=5pt,
showspaces=false,
showstringspaces=false,
showtabs=false,
tabsize=2
name = "Kod"
}
\lstset{style=mystyle}
\clearpage
\end{document}
I have no clue what this documentclass is, so I used a KOMA class. Should have no effect on lstlisting.
And mentioned in the comments, your example is not a working MWE, it is messed up with code that is not helpful to solve your issue.
The trick is simple: Just read the compilers messages. When it tells you, that there is an unknown option, you should try to remove it and compile again. numbers=true is not valid and not needed.
Doc of listings
A working example that may come close to yours:
\documentclass[]{scrartcl}
\usepackage{xcolor}
\usepackage{listings}
\usepackage{hyperref}
\begin{document}
\definecolor{codegreen}{rgb}{0,0.6,0}
\definecolor{codegray}{rgb}{0.5,0.5,0.5}
\definecolor{codepurple}{rgb}{0.58,0,0.82}
\definecolor{backcolour}{rgb}{0.6,0.9,0.1}
\renewcommand{\lstlistingname}{Kod}% Listing -> Algorithm
\lstdefinestyle{mystyle}{
backgroundcolor=\color{backcolour},
commentstyle=\color{codegreen},
keywordstyle=\color{codepurple},
numberstyle=\tiny\color{codegray},
stringstyle=\color{orange},
basicstyle=\ttfamily\tiny,
breakatwhitespace=false
commentstyle=\color{codegreen},
keywordstyle=\color{codepurple},
numberstyle=\tiny\color{codegray},
stringstyle=\color{orange},
basicstyle=\ttfamily\tiny,
breakatwhitespace=false,
breaklines=true,
captionpos=b,
keepspaces=true,
%numbers=true % <-----your tex compiler tells you that it is unknown
numbers=left,
numbersep=5pt,
showspaces=false,
showstringspaces=false,
showtabs=false,
tabsize=2,
name = "Kod"
}
\lstinputlisting[
language=python,
style=mystyle,
captionpos=t,
caption={My Python program},
label={lst:promise}
]{code.py}
In \autoref{lst:promise} I did my very best.
\end{document}
The code.py:
def main():
"""This is a function"""
return 'I will provide MWE when asking LaTeX related questions.'
# and this a line comment
if __name__=='__main__':
print(main())
The result:
When my Markdown file contains a horizontal rule --- or *** I receive an error regarding \Linethickness -> \Protect
I understand there have been issues with MiKTeX recently, however I am unsure whether they apply here.
I have been experiencing this issue since yesterday morning, when I was playing around trying to get the Lato font package to work with a set of Markdown files I need to convert to PDF. It had been working fine (asides from the font issue).
This could have happened when I updated MiKTeX, although at the time I hadn't realised that could be the case, as I was also playing with the templates, YAML, PS Script etc.
Since then I've been reading about the MiKTeX issue and I've tried further updates, updating package database, building formats, refreshing file name database and uninstalling and reinstalling. I have read the background in the comments section on GitHub but the suggestions there do not seem to have solved it for me, whereas they have for others.
This makes me question whether this is related, but I am relatively new to Tex, Markdown etc.
The original file was longer and more complex, but this Markdown
# Sample File
Test Test Test
---
Produces the same error
Error producing PDF.
! Missing number, treated as zero.
<to be read again>
\protect
\linethickness ->\protect
\linethickness
\setlength #1#2->#1 #2
\relax
\#rule ...#tempdimb {#2}\setlength \#tempdimc {#3}
\advance \#tempdimc \#temp...
l.362 ...nter}\rule{0.5\linewidth}{\linethickness}
Removing the --- allows the pdf to generate in both the above example and my more complex markdown file, even with templates.
I am unsure if linethickness is within the graphics package, when I look at package information I can't see anything that obviously indicates it is.
I would simply remove the offending lines but they are used throughout the remainder of the markdown files and I would prefer to find a fix, with your help, if possible!
Please could you let me know if I'm barking up the wrong tree with this recent MiKTeX issue or not, and if not, where I might be going wrong.
Many Thanks in advance.
Update:
I ran this command
pandoc -s sample.md -o sample.tex
to produce this tex:
% Options for packages loaded elsewhere
\PassOptionsToPackage{unicode}{hyperref}
\PassOptionsToPackage{hyphens}{url}
%
\documentclass[
]{article}
\usepackage{lmodern}
\usepackage{amssymb,amsmath}
\usepackage{ifxetex,ifluatex}
\ifnum 0\ifxetex 1\fi\ifluatex 1\fi=0 % if pdftex
\usepackage[T1]{fontenc}
\usepackage[utf8]{inputenc}
\usepackage{textcomp} % provide euro and other symbols
\else % if luatex or xetex
\usepackage{unicode-math}
\defaultfontfeatures{Scale=MatchLowercase}
\defaultfontfeatures[\rmfamily]{Ligatures=TeX,Scale=1}
\fi
% Use upquote if available, for straight quotes in verbatim environments
\IfFileExists{upquote.sty}{\usepackage{upquote}}{}
\IfFileExists{microtype.sty}{% use microtype if available
\usepackage[]{microtype}
\UseMicrotypeSet[protrusion]{basicmath} % disable protrusion for tt fonts
}{}
\makeatletter
\#ifundefined{KOMAClassName}{% if non-KOMA class
\IfFileExists{parskip.sty}{%
\usepackage{parskip}
}{% else
\setlength{\parindent}{0pt}
\setlength{\parskip}{6pt plus 2pt minus 1pt}}
}{% if KOMA class
\KOMAoptions{parskip=half}}
\makeatother
\usepackage{xcolor}
\IfFileExists{xurl.sty}{\usepackage{xurl}}{} % add URL line breaks if available
\IfFileExists{bookmark.sty}{\usepackage{bookmark}}{\usepackage{hyperref}}
\hypersetup{
hidelinks,
pdfcreator={LaTeX via pandoc}}
\urlstyle{same} % disable monospaced font for URLs
\usepackage[margin=1cm]{geometry}
\setlength{\emergencystretch}{3em} % prevent overfull lines
\providecommand{\tightlist}{%
\setlength{\itemsep}{0pt}\setlength{\parskip}{0pt}}
\setcounter{secnumdepth}{-\maxdimen} % remove section numbering
\date{}
\begin{document}
\setcounter{errorcontextlines}{40}
\hypertarget{sample-file}{%
\section{Sample File}\label{sample-file}}
Test Test Test
\begin{center}\rule{0.5\linewidth}{\linethickness}\end{center}
\end{document}
meanwhile, I tried this (as root in a latest RStudio Debian install):
~# sed 's,\\linethickness,0.5000000000pt,g' < pandoc/pandoc > /usr/lib/rstudio-server/bin/pandoc/pandoc
where the 1st pandoc/pandoc is a copy of the original from package. That keeps the same string length and valid number so that the binary won't break. That writes the hrule as:
\begin{center}\rule{0.5\linewidth}{0.5000000000pt}\end{center}
and MiKTeX seems fine with it (at least TeXworks compiles the pdf).
HTH
bye
I am using
\lstinputlisting[]{javacode/DatabaseManager-getUser}
to show some java code. However the following caption appears underneath the listing (see picture marked with red arrow):
In my preamble I have used \lstset to set title={}, however I don't want anything there, no title or caption. Is this possible? And if so how would I go about doing it?
See MattAllegros comment in OP. It made me find the issue. In my preamble I had the following setup:
\usepackage{listings}
\lstset{ %
backgroundcolor=\color{grayC},
basicstyle=\ttfamily\small,
breakatwhitespace=false,
breaklines=true,
captionpos=b,
commentstyle=\color{greencomments},
deletekeywords={...},
escapeinside={(*#}{#*)},
extendedchars=true,
frame=single,
keepspaces=true,
keywordstyle=\color{bluekeywords},
language=Java,
morekeywords={partial, var, value, get, set},
numbers=left,
numbersep=5pt,
numberstyle=\tiny\color{black},
rulecolor=\color{Dgray},
showspaces=false,
showstringspaces=false,
showtabs=false,
stepnumber=1,
stringstyle=\color{redstrings},
tabsize=2,
morekeywords= {new, std::*,},
title={}
}
I commented out captionpos=b and title={}, and now I get nothing underneath the listing as was what I wanted in OP. for output comparrison see:
I'm using Latex to write a program listing all my code and I am following this:
http://texblog.wordpress.com/2008/04/02/include-source-code-in-latex-with-listings/
It works, but my code runs of the side of the page. How can I fix this?
Additional question: How can I get it to highlight syntax? I do have lang set to Java.
Try something like this:
\documentclass{article}
\usepackage{listings}
\usepackage{color}
\usepackage{textcomp}
\definecolor{listinggray}{gray}{0.9}
\definecolor{lbcolor}{rgb}{0.9,0.9,0.9}
\lstset{
language=c,
basicstyle=\scriptsize,
upquote=true,
aboveskip={1.5\baselineskip},
columns=fullflexible,
showstringspaces=false,
extendedchars=true,
breaklines=true,
showtabs=false,
showspaces=false,
showstringspaces=false,
identifierstyle=\ttfamily,
keywordstyle=\color[rgb]{0,0,1},
commentstyle=\color[rgb]{0.133,0.545,0.133},
stringstyle=\color[rgb]{0.627,0.126,0.941},
}
\begin{document}
\begin{lstlisting}
#include <stdio.h>
int main()
{
// A line comment
printf("A really, really, really, really, really, really, really, really, really, really, really, really, really, really, really, really, REALLY long line. && & \n");
return 0;
}
\end{lstlisting}
\end{document}
which produces:
alt text http://img260.imageshack.us/img260/1608/codes.png
Did you consider
\lstset{...}
breaklines=true -> sets automatic line breaking
breakatwhitespace=false -> automatic breaks happen at whitespace
?
You want to turn on line breaking with
\lstset{breaklines=true}
in the command options. Now you might no like its choices but that is another question.
Instead of including the source directly, include it from a file:
\lstinputlisting{/Volumes/docs/p2k_files_in_qt.sh}
You'll save lots of work doing it that way. Alternatively, if you have to include source into the file, there's lgrind.
\lstset{ %
language=C, % choose the language of the code
basicstyle=\footnotesize, % the size of the fonts that are used for the code
numbers=left, % where to put the line-numbers
numberstyle=\footnotesize, % the size of the fonts that are used for the line-numbers
stepnumber=1, % the step between two line-numbers. If it's 1 each line will be numbered
numbersep=5pt, % how far the line-numbers are from the code
%backgroundcolor=\color{Blue}, % choose the background color. You must add \usepackage{color}
showspaces=false, % show spaces adding particular underscores
showstringspaces=false, % underline spaces within strings
showtabs=false, % show tabs within strings adding particular underscores
frame=single, % adds a frame around the code
tabsize=2, % sets default tabsize to 2 spaces
captionpos=b, % sets the caption-position to bottom
breaklines=true, % sets automatic line breaking
breakatwhitespace=false, % sets if automatic breaks should only happen at whitespace
escapeinside={\%*}{*)}, % if you want to add a comment within your code
% size, font
commentstyle=\fontsize{7}{7}\selectfont,
basicstyle=\ttfamily\fontsize{7}{7}\selectfont,
keywordstyle=\color{red},
commentstyle=\color{blue},
stringstyle=\color{green}
}
Use breaklines=true e. g.:
\lstnewenvironment{bash}
{\lstset{language=bash,breaklines=true,frame=trBL}}
{}
Closed. This question is off-topic. It is not currently accepting answers.
Want to improve this question? Update the question so it's on-topic for Stack Overflow.
Closed 9 years ago.
Improve this question
Please see the snippet below and tell me how can I achieve the same strike-out effect as in the main text. I am using the version of LaTeX from the latest Ubuntu repositories.
\documentclass{article}
\usepackage{ulem}
\begin{document}
The sout tag works perfect in the \sout{main text area} but not inside the equations.
$$
list = [1, \sout{2}, 3, \sout{4}, 5, \sout{6}, 7, \sout{8}, 9, \sout{10}]
$$
Any clue?
\end{document}
Here is LaTeX output
It looks like the \sout doesn't work inside a math env.
You can try doing something like this, which works:
\documentclass{article}
\usepackage{ulem}
\begin{document}
The sout tag works perfect in the \sout{main text area} but not inside the equations.
$list = $[1, \sout{2}, 3, \sout{4}, 5, \sout{6}, 7, \sout{8}, 9, \sout{10}$]$
Any clue?
\end{document}
If anyone's still interested, I just found out about the cancel package, which allows you to strike your text in math mode in a few different ways. It's not horizontal, though -- only diagonal, which in my case is much better.
If you need to keep the strikeout in Math mode (e.g., to keep Math fonts) try:
\newcommand{\msout}[1]{\text{\sout{\ensuremath{#1}}}}
then
$\msout{\mathsf{stuckout}}$
you need amsmath and ulem.
(Solution from here.)
Pretty much any non-math-mode command can be used inside mathmode by putting it within a \text{} environment, e.g.:
\documentclass{article}
\usepackage{ulem}
\begin{document}
The sout tag works perfect in the \sout{main text area} but not inside the equations.
\[ list = [1, \text{\sout{2}}, 3, \text{\sout{4}}, 5, \text{\sout{6}}, 7, \text{\sout{8}}, 9, \text{\sout{10}}] \]
Any clue?
\end{document}
And if you'd like to be able to use strike-out without having ulem redefine how \emph{} works, use \usepackage[normalem]{ulem}.